Advertisement
Guest User

Danmkufu

a guest
Jan 29th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. #TouhouDanmakufu[Single]
  2. #ScriptVersion[3]
  3. #Title["lolmyscript"]
  4. #Text["this is a script"]
  5.  
  6. //Load the default shotsheet
  7. #include"script/default_system/Default_ShotConst.txt"
  8.  
  9. //----------------------------------------------------
  10. //Declaring Global Variables
  11. //The variables declared here can be used throughout the entire script.
  12. //However, the variables declared here are static. (They can be changed, but not by themselves as they are not in the main loop)
  13. //(As execution order cannot be guaranteed, random numbers cannot be used(?))
  14. //----------------------------------------------------
  15. let objEnemy; //Enemy object
  16. let frame = 0; //Counter for timing enemy movements.(Will keep increasing by one in @MainLoop)
  17. let frame2 = 0;
  18. //----------------------------------------------------
  19. //Enemy movement
  20. //----------------------------------------------------
  21. @Event
  22. {
  23. alternative(GetEventType())
  24. case(EV_REQUEST_LIFE)
  25. {
  26. //The script requests the enemy life
  27. SetScriptResult(5000);//Set enemy life to 500
  28. }
  29. }
  30.  
  31. @Initialize
  32. {
  33. //Create and register the enemy object
  34. objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  35. ObjEnemy_Regist(objEnemy);
  36.  
  37. //Setting the enemy's image
  38. let imgExRumia = GetCurrentScriptDirectory ~ "ExRumia.png"; //file path to enemy image
  39. ObjPrim_SetTexture(objEnemy, imgExRumia); //Setting the above image file as a texture to the enemy object(objEnemy)
  40. ObjSprite2D_SetSourceRect(objEnemy, 64, 1, 127, 64); //Setting the rectangle coordinates in the enemy image to use(Left, Top, Right, Bottom).
  41. ObjSprite2D_SetDestCenter(objEnemy); //Positioning the center of the rectangle(w/texture) at (0, 0) on the stage(top left corner).
  42.  
  43. //Moving to the coordinate (cx, 60) in 60 frames
  44. let cx = GetStgFrameWidth() / 2;//defines the variable cx as the horizontal middle of the stage. (Stage width / 2)
  45. ObjMove_SetDestAtFrame(objEnemy, cx, 180, 60);
  46. }
  47.  
  48. @MainLoop
  49. {
  50. //retrieving enemy coordinates
  51. let ex = ObjMove_GetX(objEnemy);
  52. let ey = ObjMove_GetY(objEnemy);
  53. let px = ObjMove_GetX(GetPlayerX);
  54. let py = ObjMove_GetY(GetPlayerY);
  55. let angleToPlayer = atan2(py - ey, px - ex);
  56. let randx = rand(0,300);
  57. let randy = rand(0,300);
  58. let randex = rand(-50,50);
  59. let randey = rand(0,30);
  60.  
  61. if (frame>0&&frame%260==0){
  62. ObjMove_SetDestAtWeight(objEnemy,randx,randy,9,3);
  63. let angle=0;
  64. while(angle<360){
  65. curvelaser(ex,ey,5,angle,75,10,-2,DS_LIGHT_WHITE,30);
  66. curvelaser(ex,ey,5,angle,75,10,2,DS_LIGHT_GREEN,30);
  67. curvelaser(ex,ey,4,angle,75,10,-4.5,DS_LIGHT_YELLOW,30);
  68. curvelaser(ex,ey,4,angle,75,10,4.5,DS_LIGHT_ORANGE,30);
  69. curvelaser(ex,ey,3,angle,75,10,-1.5,DS_LIGHT_SKY,30);
  70. curvelaser(ex,ey,3,angle,75,10,1.5,DS_LIGHT_BLUE,30);
  71. curvelaser(ex,ey,2.5,angle,75,10,-3.75,DS_LIGHT_RED,30);
  72. curvelaser(ex,ey,2.5,angle,75,10,3.75,DS_LIGHT_PURPLE,30);
  73. angle+=60
  74. }
  75. }
  76. if (frame2>0&&frame2%1==0){
  77. let jangle= -20;
  78. while(jangle <= 20){
  79. bulletshot(ex,ey,2.5,jangle + (2.13*frame2),DS_NEEDLE_RED,15);
  80. bulletshot(ex,ey,2.5,jangle + (-2.13*frame2),DS_NEEDLE_BLUE,15);
  81. wait(3);
  82. bulletshot(ex,ey,2.5,jangle + (2.13*frame2)+180,DS_NEEDLE_ORANGE,15);
  83. bulletshot(ex,ey,2.5,jangle + (-2.13*frame2)+180,DS_NEEDLE_SKY,15);
  84. jangle += 10;
  85. }
  86. }
  87.  
  88. yield;
  89. //Setting the enemy hit box
  90. ObjEnemy_SetIntersectionCircleToShot(objEnemy, ex, ey, 32);//hitbox against player bullets. 32 is the radius.
  91. ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey, 24);//hitbox against the player. 24 is the radius.
  92.  
  93. //adding +1 to frame. "frame++" is equivalent to "frame = frame + 1;" or "frame += 1;"
  94. frame++;
  95. frame2++;
  96.  
  97. //If the enemy's life is 0
  98. if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) <= 0)
  99. {
  100. //The enemy is killed immediately when life is 0
  101. //As this is a beginner sample script,
  102. //the script is ended immediately without waiting for an explosion effect.
  103. Obj_Delete(objEnemy);
  104. CloseScript(GetOwnScriptID());
  105. return;
  106. }
  107. task curvelaser(x,y,v,angle,length,width,angvel,graphic,delay){
  108. let shot1 = ObjShot_Create(OBJ_CURVE_LASER);
  109. ObjMove_SetPosition(shot1,x,y);
  110. ObjMove_SetSpeed(shot1,v);
  111. ObjMove_SetAngle(shot1,angle);
  112. ObjLaser_SetLength(shot1,length);
  113. ObjLaser_SetRenderWidth(shot1,width);
  114. ObjMove_SetAngularVelocity(shot1,angvel);
  115. ObjShot_SetGraphic(shot1,graphic);
  116. ObjShot_SetDelay(shot1,delay);
  117. ObjShot_Regist(shot1);
  118. ObjMove_AddPatternA3(shot1,130,NO_CHANGE,NO_CHANGE,0,0,3,DS_BALL_L_ORANGE);
  119. yield;
  120. }
  121.  
  122.  
  123. task bulletshot(x,y,v,angle,graphic,delay){
  124. let shot2 = ObjShot_Create(OBJ_SHOT);
  125. ObjMove_SetPosition(shot2,x,y);
  126. ObjMove_SetSpeed(shot2,v);
  127. ObjMove_SetAngle(shot2,angle);
  128. ObjShot_SetGraphic(shot2,graphic);
  129. ObjShot_SetDelay(shot2,delay);
  130. ObjShot_SetAutoDelete(shot2,true);
  131. ObjShot_Regist(shot2);
  132. }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement