Advertisement
Guest User

Untitled

a guest
Mar 28th, 2014
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. #TouhouDanmakufu[Single]
  2. #ScriptVersion[3]
  3. #Title["Cirno Spell 2"]
  4. #Text["A New Spell for Cirno"]
  5.  
  6. #include "script/default_system/ZUNShot_Const.txt"
  7.  
  8. let bossObj;
  9. let bossX = 0;
  10. let bossY = 0;
  11. let imgBoss = GetCurrentScriptDirectory ~ "cirno.png";
  12.  
  13. @Initialize {
  14. bossObj = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  15. ObjEnemy_Regist(bossObj);
  16.  
  17. ObjMove_SetPosition(bossObj,193,-100);
  18.  
  19. ObjMove_SetDestAtSpeed(bossObj,193,120,5);
  20. mainTask;
  21. }
  22.  
  23. @Event {
  24. alternative(GetEventType())
  25. case(EV_REQUEST_LIFE)
  26. {
  27. SetScriptResult(2500);
  28. }
  29. case(EV_REQUEST_TIMER)
  30. {
  31. SetScriptResult(90);
  32. }
  33. }
  34.  
  35. @MainLoop {
  36. bossX = ObjMove_GetX(bossObj);
  37. bossY = ObjMove_GetY(bossObj);
  38.  
  39. ObjEnemy_SetIntersectionCircleToShot(bossObj,bossX,bossY,24);
  40. ObjEnemy_SetIntersectionCircleToPlayer(bossObj,bossX,bossY,30);
  41. yield;
  42.  
  43. if(ObjEnemy_GetInfo(bossObj,INFO_LIFE) <= 0) {
  44. Obj_Delete(bossObj);
  45. CloseScript(GetOwnScriptID());
  46. return;
  47.  
  48. }
  49. }
  50.  
  51. @Finalize {
  52.  
  53. }
  54.  
  55. function wait(w) {
  56. loop(w) {
  57. yield;
  58. }
  59. }
  60.  
  61. task mainTask {
  62. renderBoss;
  63. wait(30);
  64. movement;
  65. loop {
  66. wait(60);
  67. spawner;
  68. wait(300);
  69. }
  70. }
  71.  
  72. task movement {
  73. wait(60);
  74. loop {
  75. fire;
  76. wait(30);
  77. }
  78. }
  79.  
  80. task renderBoss {
  81. let dir;
  82. let speed;
  83.  
  84. ObjPrim_SetTexture(bossObj,imgBoss);
  85. ObjSprite2D_SetSourceRect(bossObj,0,0,110,110);
  86. ObjSprite2D_SetDestCenter(bossObj);
  87. ObjRender_SetScaleXYZ(bossObj,0.7,0.7,0);
  88.  
  89. while(!Obj_IsDeleted(bossObj)) {
  90. dir = ObjMove_GetAngle(bossObj);
  91. speed = ObjMove_GetSpeed(bossObj);
  92.  
  93. if(speed == 0) {
  94. ObjSprite2D_SetSourceRect(bossObj,0,0,110,110);
  95. ObjRender_SetAngleXYZ(bossObj,0,0,0);
  96. }
  97.  
  98. else if(cos(dir) < 0) {
  99. ObjSprite2D_SetSourceRect(bossObj,0,0,110,110);
  100. ObjRender_SetAngleXYZ(bossObj,0,0,0);
  101. }
  102.  
  103. else if(cos(dir) > 0) {
  104. ObjSprite2D_SetSourceRect(bossObj,0,0,110,110);
  105. ObjRender_SetAngleXYZ(bossObj,0,180,0);
  106. }
  107. yield;
  108. }
  109. }
  110.  
  111. task fire {
  112. let spin = ObjShot_Create(OBJ_SHOT);
  113. ObjShot_Regist(spin);
  114. ObjMove_SetPosition(spin,bossX,bossY);
  115. ObjMove_SetAngle(spin,rand(0,360));
  116. ObjMove_SetSpeed(spin,3);
  117. ObjShot_SetGraphic(spin,144);
  118. ObjMove_SetAngularVelocity(spin,2);
  119.  
  120. let spin2 = ObjShot_Create(OBJ_SHOT);
  121. ObjShot_Regist(spin2);
  122. ObjMove_SetPosition(spin2,bossX,bossY);
  123. ObjMove_SetAngle(spin2,rand(0,360));
  124. ObjMove_SetSpeed(spin2,3);
  125. ObjShot_SetGraphic(spin2,144);
  126. ObjMove_SetAngularVelocity(spin2,-2);
  127.  
  128. while(!Obj_IsDeleted(spin)) {
  129. ObjMove_SetPosition(spin,ObjMove_GetX(spin),ObjMove_GetY(spin)+1);
  130. yield;
  131. }
  132.  
  133. while(!Obj_IsDeleted(spin2)) {
  134. ObjMove_SetPosition(spin2,ObjMove_GetX(spin2),ObjMove_GetY(spin2)+1);
  135. yield;
  136. }
  137. }
  138.  
  139. task spawner {
  140. let spawn = ObjShot_Create(OBJ_SHOT);
  141. ObjShot_Regist(spawn);
  142. ObjMove_SetPosition(spawn,bossX,bossY);
  143. ObjMove_SetAngle(spawn,rand(210,330));
  144. ObjMove_SetSpeed(spawn,2);
  145. ObjShot_SetGraphic(spawn,286);
  146. ObjShot_SetSpellResist(spawn,true);
  147.  
  148. let shot1 = ObjShot_Create(OBJ_SHOT);
  149. ObjShot_Regist(shot1);
  150. ObjMove_SetPosition(shot1,ObjMove_GetX(spawn),ObjMove_GetY(spawn));
  151. ObjMove_SetAngle(shot1,ObjMove_GetAngle(spawn)+rand(150,210));
  152. ObjMove_SetSpeed(shot1,2);
  153. ObjShot_SetGraphic(shot1,275);
  154.  
  155. while(!Obj_IsDeleted(spawn)) {
  156. if(ObjMove_GetX(spawn) > 386 || ObjMove_GetX(spawn) < 0) {
  157. ObjMove_SetAngle(spawn,180-ObjMove_GetAngle(spawn));
  158. }
  159.  
  160. if(ObjMove_GetY(spawn) < 0) {
  161. ObjMove_SetAngle(spawn,0-ObjMove_GetAngle(spawn));
  162. }
  163.  
  164. yield;
  165. }
  166.  
  167. while(true) {
  168. ObjShot_AddShotA1(spawn,shot1,15);
  169. yield;
  170. }
  171. }
  172.  
  173. function AngleToPlayer {
  174. let dir = GetAngleToPlayer(bossObj);
  175. return dir;
  176. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement