Advertisement
Guest User

Untitled

a guest
Mar 30th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.26 KB | None | 0 0
  1.  
  2.  
  3. #TouhouDanmakufu(Single)
  4. #ScriptVersion [3]
  5. #Title ["Test5"]
  6. #Text ["Prove prove prove!"]
  7.  
  8. let bossObj;
  9. let bossX = 0;
  10. let bossY = 0;
  11. let imgBoss = GetCurrentScriptDirectory ~ "Sprite.png";
  12. let imgBossMove = GetCurrentScriptDirectory ~ "SpriteMove.png";
  13.  
  14. # include "script\default_system\Default_ShotConst.txt"
  15.  
  16. @Initialize {
  17.  
  18. // Definisce bossObj come un boss e lo registra
  19. bossObj = ObjEnemy_Create (OBJ_ENEMY_BOSS);
  20. ObjEnemy_Regist(bossObj);
  21.  
  22. // teletrasporta il boss alle coordinate
  23. ObjMove_SetPosition(bossObj,192,-100);
  24.  
  25. // Muove il boss alle coordinate X e Y desiderate alla velocità scelta
  26. ObjMove_SetDestAtSpeed(bossObj,192,120,3);
  27.  
  28. LoadSound(GetCurrentScriptDirectory ~ "tan00.wav");
  29. LoadSound(GetCurrentScriptDirectory ~ "tan01.wav");
  30. LoadSound(GetCurrentScriptDirectory ~ "tan02.wav");
  31. LoadSound(GetCurrentScriptDirectory ~ "FloweringNight.mp3");
  32. PlaySE(GetCurrentScriptDirectory ~ "FloweringNight.mp3");
  33.  
  34. mainTask; // Esegue il task
  35. }
  36.  
  37. @Event {
  38. // Settare la vita e il timer del boss
  39. alternative(GetEventType())
  40. case(EV_REQUEST_LIFE) {
  41. SetScriptResult(10000);
  42. }
  43. case(EV_REQUEST_TIMER) {
  44. SetScriptResult(80);
  45. }
  46. }
  47.  
  48. @MainLoop {
  49. bossX = ObjMove_GetX(bossObj);
  50. bossY = ObjMove_GetY(bossObj);
  51.  
  52. // collisioni per i colpi e il player
  53. ObjEnemy_SetIntersectionCircleToShot(bossObj,bossX,bossY,24);
  54. ObjEnemy_SetIntersectionCircleToPlayer(bossObj,bossX,bossY,32);
  55.  
  56. yield;
  57. }
  58.  
  59. @Finalize {
  60.  
  61. }
  62.  
  63. // Best friend
  64. function wait(w) { loop(w) { yield; } }
  65.  
  66. task mainTask {
  67. renderBoss;
  68. movement;
  69. fire;
  70. end;
  71. }
  72.  
  73. task renderBoss {
  74. let dir;
  75. let speed;
  76.  
  77. // Attribuisce una texture, o immagine, al boss e ne centra il punto di movimento
  78. ObjPrim_SetTexture(bossObj,imgBoss);
  79. ObjSprite2D_SetSourceRect(bossObj,0,0,65,83);
  80. ObjSprite2D_SetDestCenter(bossObj);
  81. // ObjRender_SetScaleXYZ(bossObj,1,1,0);
  82.  
  83. while(!Obj_IsDeleted(bossObj)) {
  84.  
  85. // Aggiorna la velocità e direzione del boss localmente
  86. dir = ObjMove_GetAngle(bossObj);
  87. speed = ObjMove_GetSpeed(bossObj);
  88.  
  89. // Mostra immagine in base al movimento del boss
  90. 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
  91. 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
  92. 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
  93.  
  94. yield;
  95. }
  96.  
  97. }
  98.  
  99. task movement {
  100. wait(400);
  101. loop {
  102. ObjMove_SetDestAtSpeed(bossObj,100,60,2); // muove il boss a sinistra
  103. wait(400);
  104. ObjMove_SetDestAtSpeed(bossObj,280,150,2); // muove il boss a destra
  105. wait(400);
  106. ObjMove_SetDestAtSpeed(bossObj,350,80,2);
  107. wait(400);
  108. ObjMove_SetDestAtSpeed(bossObj,192,120,2);
  109. wait(400);
  110. ObjMove_SetDestAtSpeed(bossObj,60,170,2);
  111. wait(400);
  112. }
  113. }
  114.  
  115. task fire {
  116. Time_Sign_Imaginary_Vertical_Time;
  117. /*loop {
  118. wait(100);
  119. //purpleRicochet;
  120. //knivesFlower;
  121. }*/
  122. }
  123.  
  124. function angleToPlayer {
  125. let dir = atan2(GetPlayerY-bossY,GetPlayerX-bossX);
  126. return dir;
  127. }
  128.  
  129. task knivesFlower{
  130. let angle = GetAngleToPlayer(bossObj);
  131. let angle2 = GetAngleToPlayer(bossObj);
  132. ascent(i in 0..24){
  133. loop(20){
  134. CreateShotA1(ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 1.5+i/12, angle,145 , 5);
  135. CreateShotA1(ObjMove_GetX(bossObj), ObjMove_GetY(bossObj), 1.5+i/12, angle2,150, 5);
  136. angle+=360/6; angle2+=360/6;
  137. }
  138. angle+=12;
  139. angle2-=12;
  140. wait(5);
  141. }
  142. }
  143.  
  144. task purpleRicochet {
  145. if (ObjEnemy_GetInfo(bossObj,INFO_LIFE) < 10000) {
  146. let minx = 0;
  147. let maxx = 384;
  148. let maxy = 440;
  149. let miny = 0;
  150. let purpleObj1;
  151. PlaySE(GetCurrentScriptDirectory ~ "tan01.wav");
  152. purpleObj1 = CreateShotA1(bossX,bossY,2,GetAngleToPlayer(bossObj),151,20);
  153. loop {
  154. if (ObjMove_GetX(purpleObj1) < minx || ObjMove_GetX(purpleObj1) > maxx) {ObjMove_SetAngle(purpleObj1,180-ObjMove_GetAngle(purpleObj1)); ObjMove_SetSpeed(purpleObj1,0.25+ObjMove_GetSpeed(purpleObj1))}
  155. if (ObjMove_GetY(purpleObj1) < miny || ObjMove_GetY(purpleObj1) > maxy) {ObjMove_SetAngle(purpleObj1,360-ObjMove_GetAngle(purpleObj1)); ObjMove_SetSpeed(purpleObj1,0.25+ObjMove_GetSpeed(purpleObj1))}
  156. yield;
  157. }
  158. }
  159. }
  160.  
  161. //Ultima Created this
  162. task Time_Sign_Imaginary_Vertical_Time{
  163.  
  164. let shot_array = []; //Prepare an array for usage later.
  165.  
  166. loop(200){yield;} //Yielding 200 times going by your original code
  167.  
  168. //Create a ring of bullets that spawn other bullets
  169. ascent(i in 0..13){
  170. CreateBulletSpecial(ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),3,360/13*i,150,15,-0.7);
  171. CreateBulletSpecial(ObjMove_GetX(bossObj),ObjMove_GetY(bossObj),3,360/13*i,150,15,0.7);
  172. }
  173.  
  174.  
  175. loop(320){yield;} //Wait 3 secs
  176.  
  177. //fill the array we created earlier with the object id of every bullet on the screen
  178. //within the radius of 999px
  179. shot_array = GetShotIdInCircleA2(384/2,448/2,999,TARGET_ENEMY);
  180.  
  181. //Give all of the bullets acceleration and a speed cap and change the color to purple
  182. ascent(i in 0..length(shot_array)){
  183. ObjMove_SetAcceleration(shot_array[i],0.01);
  184. ObjMove_SetMaxSpeed(shot_array[i],3);
  185. ObjShot_SetGraphic(shot_array[i],151);
  186. }
  187.  
  188. //End of task
  189.  
  190. }
  191.  
  192. function CreateBulletSpecial(X,Y,SPEED,ANGLE,GRAPHIC,DELAY,VELOCITY){
  193.  
  194. //Create a bullet and assign it's object id inside of a variable.
  195. let obj = CreateShotA1(X,Y,SPEED,ANGLE,GRAPHIC,DELAY);
  196.  
  197. //Increases the bullet's angle by a value (be careful or you may have looping bullets that never leave the screen)
  198. ObjMove_SetAngularVelocity(obj,VELOCITY);
  199.  
  200. //Apply special actions to the bullet when it is spawned.
  201. BulletActions;
  202.  
  203. task BulletActions{
  204. while(!Obj_IsDeleted(obj)){ //As long as the bullet exists do the following below
  205.  
  206. //Create another bullet at the main's position with the same angle.
  207. CreateShotA1(ObjMove_GetX(obj),ObjMove_GetY(obj),0,ObjMove_GetAngle(obj),152,15);
  208.  
  209. //Yield 20 times before creating the next bullet.
  210. loop(20){yield;}
  211. }
  212.  
  213. //End of task
  214.  
  215. }
  216. return obj
  217.  
  218. //End of Function
  219.  
  220. }
  221.  
  222. task end {
  223. loop {
  224. if (ObjEnemy_GetInfo(bossObj, INFO_LIFE) == 0) {
  225. DeleteShotAll(TYPE_ALL,TYPE_IMMEDIATE);
  226. RemoveSound(GetCurrentScriptDirectory ~ "tan00.wav");
  227. RemoveSound(GetCurrentScriptDirectory ~ "tan01.wav");
  228. RemoveSound(GetCurrentScriptDirectory ~ "tan02.wav");
  229. Obj_Delete(bossObj);
  230. }
  231. yield;
  232. }
  233. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement