ScriptGen.cpp
资源名称:g.rar [点击查看]
上传用户:laitongbao
上传日期:2021-02-20
资源大小:8176k
文件大小:1k
源码类别:

射击游戏

开发平台:

Visual C++

  1. // ScriptGen.cpp : Defines the entry point for the console application.
  2. //
  3. #include "stdafx.h"
  4. #include "stdio.h"
  5. #include "stdlib.h"
  6. #include "..includecgl.h"
  7. #pragma comment(lib,"..\CGLLIB.lib")
  8. int main(int argc, char* argv[])
  9. {
  10. int num = 200;
  11. FILE * file;
  12. file = fopen("script.txt","w");
  13. if(argc == 1)
  14.  num = 200;
  15. else
  16. num = atoi(argv[0]);
  17. RandGenerator rand(23);
  18. for(int i = 0 ;i<num ;i++ )
  19. {
  20. float posx = rand.GetFloat(-100,100);
  21. float posy = 0;
  22. float posz = rand.GetFloat(200.f,500.f);
  23. float vx   = rand.GetFloat(-20.f,20.f);
  24. float vy =  0;
  25. float vz =  rand.GetFloat(-50.f,-60.f);
  26. fprintf(file,"%i: Enemy1 %f %f %f %f %f %f 0n",i,posx,posy,posz,vx,vy,vz);
  27. printf("%i: Enemy1 %f %f %f %f %f %f 0n",i,posx,posy,posz,vx,vy,vz);
  28. }
  29. fclose(file);
  30. return 0;
  31. }