Advertisement
Guest User

Danmakufu Script

a guest
Mar 30th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.73 KB | None | 0 0
  1. #TouhouDanmakufu(Single)
  2. #ScriptVersion [3]
  3. #Title ["Test5"]
  4. #Text ["Prove prove prove!"]
  5.  
  6. let bossObj;
  7. let bossX = 0;
  8. let bossY = 0;
  9. let imgBoss = GetCurrentScriptDirectory ~ "Sprite.png";
  10. let imgBossMove = GetCurrentScriptDirectory ~ "SpriteMove.png";
  11.  
  12. # include "script\default_system\Default_ShotConst.txt"
  13.  
  14. @Initialize {
  15.  
  16. // Definisce bossObj come un boss e lo registra
  17. bossObj = ObjEnemy_Create (OBJ_ENEMY_BOSS);
  18. ObjEnemy_Regist(bossObj);
  19.  
  20. // teletrasporta il boss alle coordinate
  21. ObjMove_SetPosition(bossObj,192,-100);
  22.  
  23. // Muove il boss alle coordinate X e Y desiderate alla velocità scelta
  24. ObjMove_SetDestAtSpeed(bossObj,192,120,3);
  25.  
  26. LoadSound(GetCurrentScriptDirectory ~ "tan00.wav");
  27. LoadSound(GetCurrentScriptDirectory ~ "tan01.wav");
  28. LoadSound(GetCurrentScriptDirectory ~ "tan02.wav");
  29. LoadSound(GetCurrentScriptDirectory ~ "FloweringNight.mp3");
  30. PlaySE(GetCurrentScriptDirectory ~ "FloweringNight.mp3");
  31.  
  32. mainTask; // Esegue il task
  33. }
  34.  
  35. @Event {
  36. // Settare la vita e il timer del boss
  37. alternative(GetEventType())
  38. case(EV_REQUEST_LIFE) {
  39. SetScriptResult(10000);
  40. }
  41. case(EV_REQUEST_TIMER) {
  42. SetScriptResult(80);
  43. }
  44. }
  45.  
  46. @MainLoop {
  47. bossX = ObjMove_GetX(bossObj);
  48. bossY = ObjMove_GetY(bossObj);
  49.  
  50. // collisioni per i colpi e il player
  51. ObjEnemy_SetIntersectionCircleToShot(bossObj,bossX,bossY,24);
  52. ObjEnemy_SetIntersectionCircleToPlayer(bossObj,bossX,bossY,32);
  53.  
  54. yield;
  55. }
  56.  
  57. @Finalize {
  58.  
  59. }
  60.  
  61. // Best friend
  62. function wait(w) { loop(w) { yield; } }
  63.  
  64. task mainTask {
  65. renderBoss;
  66. movement;
  67. fire;
  68. end;
  69. }
  70.  
  71. task renderBoss {
  72. let dir;
  73. let speed;
  74.  
  75. // Attribuisce una texture, o immagine, al boss e ne centra il punto di movimento
  76. ObjPrim_SetTexture(bossObj,imgBoss);
  77. ObjSprite2D_SetSourceRect(bossObj,0,0,65,83);
  78. ObjSprite2D_SetDestCenter(bossObj);
  79. // ObjRender_SetScaleXYZ(bossObj,1,1,0);
  80.  
  81. while(!Obj_IsDeleted(bossObj)) {
  82.  
  83. // Aggiorna la velocità e direzione del boss localmente
  84. dir = ObjMove_GetAngle(bossObj);
  85. speed = ObjMove_GetSpeed(bossObj);
  86.  
  87. // Mostra immagine in base al movimento del boss
  88. if(speed == 0) {ObjPrim_SetTexture(bossObj,imgBoss); ObjSprite2D_SetSourceRect(bossObj,0,0,65,83); ObjSprite2D_SetDestCenter(bossObj); ObjRender_SetAngleXYZ(bossObj,0,0,0); } // Boss fermo
  89. else if(cos(dir) < 0) {ObjPrim_SetTexture(bossObj,imgBossMove); ObjSprite2D_SetSourceRect(bossObj,0,0,50,76); ObjSprite2D_SetDestCenter(bossObj); ObjRender_SetAngleXYZ(bossObj,0,180,0); } // Boss verso sinistra
  90. else if(cos(dir) > 0) {ObjPrim_SetTexture(bossObj,imgBossMove); ObjSprite2D_SetSourceRect(bossObj,0,0,50,76); ObjSprite2D_SetDestCenter(bossObj); ObjRender_SetAngleXYZ(bossObj,0,0,0); } // Boss verso destra
  91.  
  92. yield;
  93. }
  94.  
  95. }
  96.  
  97. task movement {
  98. wait(400);
  99. loop {
  100. ObjMove_SetDestAtSpeed(bossObj,100,60,2); // muove il boss a sinistra
  101. wait(400);
  102. ObjMove_SetDestAtSpeed(bossObj,280,150,2); // muove il boss a destra
  103. wait(400);
  104. ObjMove_SetDestAtSpeed(bossObj,350,80,2);
  105. wait(400);
  106. ObjMove_SetDestAtSpeed(bossObj,192,120,2);
  107. wait(400);
  108. ObjMove_SetDestAtSpeed(bossObj,60,170,2);
  109. wait(400);
  110. }
  111. }
  112.  
  113. task fire {
  114. eruptKnives;
  115. /*loop {
  116. wait(100);
  117. //purpleRicochet;
  118. //knivesFlower;
  119. }*/
  120. }
  121.  
  122. function angleToPlayer {
  123. let dir = atan2(GetPlayerY-bossY,GetPlayerX-bossX);
  124. return dir;
  125. }
  126.  
  127. task knivesFlower{
  128. let angle = GetAngleToPlayer(bossObj);
  129. let angle2 = GetAngleToPlayer(bossObj);
  130. ascent(i in 0..24){
  131. loop(20){
  132. CreateShotA1(ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 1.5+i/12, angle,145 , 5);
  133. CreateShotA1(ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 1.5+i/12, angle2,150, 5);
  134. angle+=360/6; angle2+=360/6;
  135. }
  136. angle+=12;
  137. angle2-=12;
  138. wait(5);
  139. }
  140. }
  141.  
  142. task purpleRicochet {
  143. if (ObjEnemy_GetInfo(bossObj,INFO_LIFE) < 10000) {
  144. let minx = 0;
  145. let maxx = 384;
  146. let maxy = 440;
  147. let miny = 0;
  148. let purpleObj1;
  149. PlaySE(GetCurrentScriptDirectory ~ "tan01.wav");
  150. purpleObj1 = CreateShotA1(bossX,bossY,2,GetAngleToPlayer(bossObj),151,20);
  151. loop {
  152. if (ObjMove_GetX(purpleObj1) < minx || ObjMove_GetX(purpleObj1) > maxx) {ObjMove_SetAngle(purpleObj1,180-ObjMove_GetAngle(purpleObj1)); ObjMove_SetSpeed(purpleObj1,0.25+ObjMove_GetSpeed(purpleObj1))}
  153. if (ObjMove_GetY(purpleObj1) < miny || ObjMove_GetY(purpleObj1) > maxy) {ObjMove_SetAngle(purpleObj1,360-ObjMove_GetAngle(purpleObj1)); ObjMove_SetSpeed(purpleObj1,0.25+ObjMove_GetSpeed(purpleObj1))}
  154. yield;
  155. }
  156. }
  157. }
  158.  
  159. task eruptKnives{
  160. let dir = angleToPlayer;
  161. let shotCount = 0;
  162. let greyObj1;
  163. let greyObj2;
  164. let greyObj3;
  165. let greyObj4;
  166. let greyObj5;
  167. let greyObj6;
  168. let greyObj7;
  169. let greyObj8;
  170. let greyObj9;
  171. let greyObj10;
  172. let greyObj11;
  173. let greyObj12;
  174. let greyObj13;
  175. wait(200);
  176. loop {
  177. if (shotCount < 3) {
  178. let blueObj1 = CreateShotA1(bossX, bossY, 3, angleToPlayer+5, 150, 0);
  179. let blueObj2 = CreateShotA1(bossX, bossY, 3, angleToPlayer+10, 150, 0);
  180. let blueObj3 = CreateShotA1(bossX, bossY, 3, angleToPlayer+15, 150, 0);
  181. let blueObj4 = CreateShotA1(bossX, bossY, 3, angleToPlayer-5, 150, 0);
  182. let blueObj5 = CreateShotA1(bossX, bossY, 3, angleToPlayer-10, 150, 0);
  183. let blueObj6 = CreateShotA1(bossX, bossY, 3, angleToPlayer-15, 150, 0);
  184. let blueObj7 = CreateShotA1(bossX, bossY, 3, angleToPlayer, 150, 0);
  185. let blueObj8 = CreateShotA1(bossX, bossY, 3, angleToPlayer+80, 150, 0);
  186. let blueObj9 = CreateShotA1(bossX, bossY, 3, angleToPlayer+70, 150, 0);
  187. let blueObj10 = CreateShotA1(bossX, bossY, 3, angleToPlayer+60, 150, 0);
  188. let blueObj11 = CreateShotA1(bossX, bossY, 3, angleToPlayer-80, 150, 0);
  189. let blueObj12 = CreateShotA1(bossX, bossY, 3, angleToPlayer-70, 150, 0);
  190. let blueObj13 = CreateShotA1(bossX, bossY, 3, angleToPlayer-60, 150, 0);
  191. ObjMove_SetAngularVelocity(blueObj1, 0.003*angleToPlayer);
  192. ObjMove_SetAngularVelocity(blueObj2, 0.006*angleToPlayer);
  193. ObjMove_SetAngularVelocity(blueObj3, 0.009*angleToPlayer);
  194. ObjMove_SetAngularVelocity(blueObj4, -0.003*angleToPlayer);
  195. ObjMove_SetAngularVelocity(blueObj5, -0.006*angleToPlayer);
  196. ObjMove_SetAngularVelocity(blueObj6, -0.009*angleToPlayer);
  197. ObjMove_SetAngularVelocity(blueObj7, 0.000*angleToPlayer);
  198. ObjMove_SetAngularVelocity(blueObj8, -0.002*angleToPlayer);
  199. ObjMove_SetAngularVelocity(blueObj9, -0.004*angleToPlayer);
  200. ObjMove_SetAngularVelocity(blueObj10, -0.006*angleToPlayer);
  201. ObjMove_SetAngularVelocity(blueObj11, 0.002*angleToPlayer);
  202. ObjMove_SetAngularVelocity(blueObj12, 0.004*angleToPlayer);
  203. ObjMove_SetAngularVelocity(blueObj13, 0.006*angleToPlayer);
  204. let objangle1 = ObjMove_GetAngle(blueObj1);
  205. let objangle2 = ObjMove_GetAngle(blueObj2);
  206. let objangle3 = ObjMove_GetAngle(blueObj3);
  207. let objangle4 = ObjMove_GetAngle(blueObj4);
  208. let objangle5 = ObjMove_GetAngle(blueObj5);
  209. let objangle6 = ObjMove_GetAngle(blueObj6);
  210. let objangle7 = ObjMove_GetAngle(blueObj7);
  211. let objangle8 = ObjMove_GetAngle(blueObj8);
  212. let objangle9 = ObjMove_GetAngle(blueObj9);
  213. let objangle10 = ObjMove_GetAngle(blueObj10);
  214. let objangle11 = ObjMove_GetAngle(blueObj11);
  215. let objangle12 = ObjMove_GetAngle(blueObj12);
  216. let objangle13 = ObjMove_GetAngle(blueObj13);
  217. shotCount = shotCount+1;
  218. loop(10){
  219. wait(20);
  220. greyObj1 = CreateShotOA1(blueObj1, 0, ObjMove_GetAngle(blueObj1), 152, 30);
  221. greyObj2 = CreateShotOA1(blueObj2, 0, ObjMove_GetAngle(blueObj2), 152, 30);
  222. greyObj3 = CreateShotOA1(blueObj3, 0, ObjMove_GetAngle(blueObj3), 152, 30);
  223. greyObj4 = CreateShotOA1(blueObj4, 0, ObjMove_GetAngle(blueObj4), 152, 30);
  224. greyObj5 = CreateShotOA1(blueObj5, 0, ObjMove_GetAngle(blueObj5), 152, 30);
  225. greyObj6 = CreateShotOA1(blueObj6, 0, ObjMove_GetAngle(blueObj6), 152, 30);
  226. greyObj7 = CreateShotOA1(blueObj7, 0, ObjMove_GetAngle(blueObj7), 152, 30);
  227. greyObj8 = CreateShotOA1(blueObj8, 0, ObjMove_GetAngle(blueObj8), 152, 30);
  228. greyObj9 = CreateShotOA1(blueObj9, 0, ObjMove_GetAngle(blueObj9), 152, 30);
  229. greyObj10 = CreateShotOA1(blueObj10, 0, ObjMove_GetAngle(blueObj10), 152, 30);
  230. greyObj11 = CreateShotOA1(blueObj11, 0, ObjMove_GetAngle(blueObj11), 152, 30);
  231. greyObj12 = CreateShotOA1(blueObj12, 0, ObjMove_GetAngle(blueObj12), 152, 30);
  232. greyObj13 = CreateShotOA1(blueObj13, 0, ObjMove_GetAngle(blueObj13), 152, 30);
  233. //objangle+=360/8;
  234. }
  235. if (shotCount == 3) {
  236. ObjMove_AddPatternA2(greyObj1,200,1,NO_CHANGE,0.5,NO_CHANGE,10);
  237. ObjMove_SetMaxSpeed(greyObj2,0.1);
  238. ObjMove_SetAcceleration(greyObj1,0.5);
  239. ObjMove_SetSpeed(greyObj2,0.1);
  240. ObjMove_SetAcceleration(greyObj2,0.005);
  241. ObjMove_SetSpeed(greyObj3,0.1);
  242. ObjMove_SetAcceleration(greyObj3,0.005);
  243. ObjMove_SetSpeed(greyObj4,0.1);
  244. ObjMove_SetAcceleration(greyObj4,0.005);
  245. ObjMove_SetSpeed(greyObj5,0.1);
  246. ObjMove_SetAcceleration(greyObj5,0.005);
  247. ObjMove_SetSpeed(greyObj6,0.1);
  248. ObjMove_SetAcceleration(greyObj6,0.005);
  249. ObjMove_SetSpeed(greyObj7,0.1);
  250. ObjMove_SetAcceleration(greyObj7,0.005);
  251. ObjMove_SetSpeed(greyObj8,0.1);
  252. ObjMove_SetAcceleration(greyObj8,0.005);
  253. ObjMove_SetSpeed(greyObj9,0.1);
  254. ObjMove_SetAcceleration(greyObj9,0.005);
  255. ObjMove_SetSpeed(greyObj10,0.1);
  256. ObjMove_SetAcceleration(greyObj10,0.005);
  257. ObjMove_SetSpeed(greyObj11,0.1);
  258. ObjMove_SetAcceleration(greyObj11,0.005);
  259. ObjMove_SetSpeed(greyObj12,0.1);
  260. ObjMove_SetAcceleration(greyObj12,0.005);
  261. ObjMove_SetSpeed(greyObj13,0.1);
  262. ObjMove_SetAcceleration(greyObj13,0.005);
  263. shotCount = 0;
  264. wait(500);
  265. }
  266. }
  267. }
  268. }
  269.  
  270. task end {
  271. loop {
  272. if (ObjEnemy_GetInfo(bossObj, INFO_LIFE) == 0) {
  273. DeleteShotAll(TYPE_ALL,TYPE_IMMEDIATE);
  274. RemoveSound(GetCurrentScriptDirectory ~ "tan00.wav");
  275. RemoveSound(GetCurrentScriptDirectory ~ "tan01.wav");
  276. RemoveSound(GetCurrentScriptDirectory ~ "tan02.wav");
  277. Obj_Delete(bossObj);
  278. }
  279. yield;
  280. }
  281. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement