Advertisement
Yasden

Stage 1 Script

Jan 15th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.39 KB | None | 0 0
  1. #TouhouDanmakufu[Stage]
  2. #ScriptVersion[3]
  3. #Title["MMM Stage 1"]
  4. #Text["See title."]
  5. #Background["script/default_system/Default_Background_IceMountain.txt"]
  6. #include "script/default_system/Default_ShotConst.txt"
  7. #include "script/default_system/Default_Effect.txt"
  8. #include "script/MMM/Function_Splash.txt"
  9. #include "script/MMM/Function_Dialogue.txt"
  10. function wait(w) { loop(w) { yield; } }
  11. function waitS(q) { loop(q*60){yield;}}
  12. //BGM LOOP TIMES: 12.566, 127
  13. let fairy = GetCurrentScriptDirectory ~ "/img/enm.png";
  14. let BGM = GetCurrentScriptDirectory ~ "/sound/STG1.ogg";
  15. let Bullet = GetCurrentScriptDirectory ~ "/sound/Bullet.wav";
  16. let enmdie = GetCurrentScriptDirectory ~ "/sound/enmdie.wav";
  17. let hght = GetStgFrameHeight();
  18. let wdth = GetStgFrameWidth();
  19. @Initialize {
  20.     LoadSound(BGM);
  21.     LoadSound(Bullet);
  22.     LoadSound(enmdie);
  23.     LoadTexture(fairy);
  24.     wait(60);
  25.     PlayBGM(BGM, 12.566, 127);
  26. CreateCommonDataArea("SpellFunctions");
  27.     LoadCommonDataAreaA1("SpellFunctions");
  28.     StageStart;
  29.    
  30. }
  31.  
  32. @MainLoop {
  33.  
  34.     yield;
  35. }
  36.  
  37. @Finalize {
  38.  
  39. }
  40.  
  41. task StageStart {
  42.     let dir = GetCurrentScriptDirectory();
  43.  
  44.     Splash(1);
  45.     waitS(13);
  46.    
  47. SpawnEnemies;
  48.  
  49. }
  50.  
  51. task Enemy01(x, y, xDest, yDest, spd) {
  52.  
  53. let Enm1 = ObjEnemy_Create(OBJ_ENEMY);
  54. let Enm1X = 0;
  55. let Enm1Y = 0;
  56. ObjEnemy_Regist(Enm1);
  57. ObjEnemy_SetLife(Enm1, 150);
  58. ObjPrim_SetTexture(Enm1, fairy);
  59. ObjRender_SetScaleXYZ(Enm1, 1, 1, 1);
  60. ObjSprite2D_SetSourceRect(Enm1, 0, 0, 32, 32);
  61. ObjSprite2D_SetDestCenter(Enm1);
  62. ObjMove_SetPosition(Enm1, x, y);
  63. ObjMove_SetDestAtSpeed(Enm1, xDest, yDest, spd);
  64. let countFrame = 0;
  65.     while(ObjEnemy_GetInfo(Enm1,INFO_LIFE)>0){
  66.         Enm1X = ObjMove_GetX(Enm1);
  67.         Enm1Y = ObjMove_GetY(Enm1);
  68.         ObjEnemy_SetIntersectionCircleToShot(Enm1, Enm1X, Enm1Y, 10);
  69.         countFrame++;
  70.         if(countFrame == 30) {//Should enemy shoot?
  71.         fireE;
  72.         countFrame = 0;
  73.         }
  74.             if (Enm1Y > hght+40) {//Testing to see if enemy should be deleted
  75.         Obj_Delete(Enm1);
  76.         }
  77.         yield;
  78.     }
  79.     PlaySE(enmdie);
  80.     AddScore(5000);
  81.     TExplosionA(Enm1X, Enm1Y, 10, 0.1);
  82.     Obj_Delete(Enm1);
  83.                             task fireE {
  84.                                 CreateShotA1(Enm1X,Enm1Y,1,GetAngleToPlayer(Enm1), 245,0);     
  85.                                 PlaySE(Bullet);
  86.                                         }
  87. }
  88.  
  89. task Enemy02(x, y, xDest, yDest, spd, dir) {
  90.  
  91. let Enm2 = ObjEnemy_Create(OBJ_ENEMY);
  92. let Enm2X = 0;
  93. let Enm2Y = 0;
  94. ObjEnemy_Regist(Enm2);
  95. ObjEnemy_SetLife(Enm2, 150);
  96. ObjPrim_SetTexture(Enm2, fairy);
  97. ObjRender_SetScaleXYZ(Enm2, 1, 1, 1);
  98. ObjSprite2D_SetSourceRect(Enm2, 0, 0, 32, 32);
  99. ObjSprite2D_SetDestCenter(Enm2);
  100. ObjMove_SetPosition(Enm2, x, y);
  101. ObjMove_SetDestAtSpeed(Enm2, xDest, yDest, spd);
  102. let countFrame = 0;
  103. let delFrame = 0;
  104.     while(ObjEnemy_GetInfo(Enm2,INFO_LIFE)>0){
  105.         Enm2X = ObjMove_GetX(Enm2);
  106.         Enm2Y = ObjMove_GetY(Enm2);
  107.         ObjEnemy_SetIntersectionCircleToShot(Enm2, Enm2X, Enm2Y, 10);
  108.         countFrame++;
  109.                                 if(countFrame == 60) { //Should the enemy shoot this frame?
  110.                                 fireE;
  111.                                 countFrame = 0;
  112.                                 }
  113.         if (Enm2X >= wdth+40 && dir == "RIGHT" ) {          //Testing to see if enemy should be deleted
  114.         Obj_Delete(Enm2);
  115.         }
  116.         if (Enm2X <= -40 && dir == "LEFT" ) {//Testing to see if enemy should be deleted
  117.         Obj_Delete(Enm2);
  118.         }
  119.         yield;
  120.     }
  121.     PlaySE(enmdie);
  122.     AddScore(5000);
  123.     TExplosionA(Enm2X, Enm2Y, 10, 0.1);
  124.     Obj_Delete(Enm2);
  125.                             task fireE {
  126.                             ascent(i in 0..18){
  127.                                 CreateShotA1(Enm2X,Enm2Y,0.7,i*20+rand(1,10), 243,0);      
  128.                                 }
  129.                                 PlaySE(Bullet);
  130.                                         }
  131. }
  132.  
  133. task Enemy03(x, y, xDest, yDest, spd) {
  134.  
  135. let Enm3 = ObjEnemy_Create(OBJ_ENEMY);
  136. let Enm3X = 0;
  137. let Enm3Y = 0;
  138. ObjEnemy_Regist(Enm3);
  139. ObjEnemy_SetLife(Enm3, 50);
  140. ObjPrim_SetTexture(Enm3, fairy);
  141. ObjRender_SetScaleXYZ(Enm3, 1, 1, 1);
  142. ObjSprite2D_SetSourceRect(Enm3, 0, 0, 32, 32);
  143. ObjSprite2D_SetDestCenter(Enm3);
  144. ObjMove_SetPosition(Enm3, x, y);
  145. ObjMove_SetDestAtSpeed(Enm3, xDest, yDest, spd);
  146. let countFrame = 0;
  147.     while(ObjEnemy_GetInfo(Enm3,INFO_LIFE)>0){
  148.         Enm3X = ObjMove_GetX(Enm3);
  149.         Enm3Y = ObjMove_GetY(Enm3);
  150.         ObjEnemy_SetIntersectionCircleToShot(Enm3, Enm3X, Enm3Y, 10);
  151.         countFrame++;
  152.         if(countFrame == 30) {//Should enemy shoot?
  153.         fireE;
  154.         countFrame = 0;
  155.         }
  156.             if (Enm3Y > hght+40) {//Testing to see if enemy should be deleted
  157.         Obj_Delete(Enm3);
  158.         }
  159.         yield;
  160.     }
  161.     PlaySE(enmdie);
  162.     AddScore(2000);
  163.     TExplosionA(Enm3X, Enm3Y, 10, 0.1);
  164.     Obj_Delete(Enm3);
  165.                             task fireE {
  166.                                 CreateShotA1(Enm3X,Enm3Y,2,GetAngleToPlayer(Enm3), 245,0);     
  167.                                 PlaySE(Bullet);
  168.                                         }
  169. }
  170.  
  171. task Enemy04(x, y, xDest, yDest, spd) {
  172.  
  173. let Enm4 = ObjEnemy_Create(OBJ_ENEMY);
  174. let Enm4X = 0;
  175. let Enm4Y = 0;
  176. ObjEnemy_Regist(Enm4);
  177. ObjEnemy_SetLife(Enm4, 20);
  178. ObjPrim_SetTexture(Enm4, fairy);
  179. ObjRender_SetScaleXYZ(Enm4, 1, 1, 1);
  180. ObjSprite2D_SetSourceRect(Enm4, 0, 0, 32, 32);
  181. ObjSprite2D_SetDestCenter(Enm4);
  182. ObjMove_SetPosition(Enm4, x, y);
  183. ObjMove_SetDestAtSpeed(Enm4, xDest, yDest, spd);
  184. let countFrame = 0;
  185.     while(ObjEnemy_GetInfo(Enm4,INFO_LIFE)>0){
  186.         Enm4X = ObjMove_GetX(Enm4);
  187.         Enm4Y = ObjMove_GetY(Enm4);
  188.         ObjEnemy_SetIntersectionCircleToShot(Enm4, Enm4X, Enm4Y, 10);
  189.             if (Enm4Y > hght+40) {//Testing to see if enemy should be deleted
  190.         Obj_Delete(Enm4);
  191.         }
  192.         yield;
  193.     }
  194.     PlaySE(enmdie);
  195.     AddScore(2000);
  196.     TExplosionA(Enm4X, Enm4Y, 10, 0.1);
  197.     Obj_Delete(Enm4);
  198. }
  199.  
  200.  
  201. task SpawnEnemies {
  202.     let dir = GetCurrentScriptDirectory();
  203.  
  204.             Enemy01(100, -20, 100, 800, 2);
  205.             Enemy01(300, -20, 300, 800, 2); //initial few enemies
  206.             waitS(9); // 22 SECONDS
  207. loop(4){
  208. Enemy02(-20, 30, 600, 30, 3, "RIGHT"); //launch a line of four enemies shooting bullets kind of fast to the right side
  209. wait(30);
  210. } //26 SECONDS
  211. loop(4){
  212.             Enemy02(wdth+20, 80, -60, 80, 3, "LEFT"); //launch a line of four enemies shooting bullets kind of fast to the left side
  213.             wait(30);
  214.             } //30 SECONDS
  215. loop(10) {
  216. Enemy03(wdth/2, -20, rand(50, wdth-50), 800, 3);
  217. Enemy03(wdth/2, -20, rand(wdth/2 -30, wdth/2 + 30), 800, 3);
  218. wait(30);
  219. } //35 SECONDS
  220. waitS(5); //40 SECONDS
  221. loop(30) { //barrage before midboss
  222. Enemy04(rand(10, wdth-10), -20, rand(10, wdth-10), 800, 5);
  223. Enemy04(rand(10, wdth-10), -20, rand(10, wdth-10), 800, 5);
  224. wait(10);
  225. }
  226. //45 SECONDS
  227. waitS(7);
  228. let MdBss1 = LoadScript(dir ~ "Stage 1 Midboss1.txt");
  229.  
  230. StartScript(MdBss1);
  231.  
  232. while(!IsCloseScript(MdBss1) && GetPlayerState() != STATE_END) {
  233.     yield;
  234.     }
  235.  
  236.     let MdBss2 = LoadScript(dir ~ "Stage 1 Midboss2.txt");
  237.  
  238. StartScript(MdBss2);
  239.  
  240. while(!IsCloseScript(MdBss2) && GetPlayerState() != STATE_END) {
  241.     yield;
  242.     }
  243.  
  244.     let MdBss3 = LoadScript(dir ~ "Stage 1 Midboss3.txt");
  245.  
  246. StartScript(MdBss3);
  247.  
  248. while(!IsCloseScript(MdBss3) && GetPlayerState() != STATE_END) {
  249.     yield;
  250.     }
  251.  
  252.     let posNew = 0;
  253. loop(4){
  254.     posNew = rand(20, cx- 20);
  255. Enemy01(posNew, -20, posNew, 800, 5);
  256.         wait(15);
  257.         }
  258. loop(4){
  259.     posNew = rand(cx+20, GetStgFrameWidth - 20);
  260. Enemy01(posNew, -20, posNew, 800, 5);
  261.         wait(15);
  262.         }
  263.         waitS(7);
  264. let Script = LoadScript(dir ~ "Stage 1 Boss.txt");
  265. DialogueStarter(0, GetCurrentScriptDirectory ~ "/img/LilyCutin.png", 290, 235, "Lily White", "Ugh, I hate being all the way up here.");
  266. wait(10);
  267.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  268. ChangeText(1, "What's so bad about being in the Land     Above the Clouds?", 0, 1, 0);
  269. wait(10);
  270.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  271. ChangeText(0, "Hm...?", 0, 1, 0);
  272. wait(10);
  273.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  274. ChangeText(1, "After all, it's the place where I live!", 1, 1, 2);
  275. wait(10);
  276.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  277. ChangeText(0, "You biased idiot... Did you screw up the   mushrooms?", 0, 1, 1);
  278. wait(10);
  279.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  280. ChangeText(1, "Doubtful... Now, I'll show you the  way    out if you don't like it here!", 0, 1, 2);
  281. wait(10);
  282.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  283. ChangeText(0, "...", 0, 1, 0);
  284. wait(10);
  285.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  286. ChangeText(1, "...", 0, 1, 0);
  287. wait(10);
  288.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  289. ChangeText(0, "Justin isn't very good at writing         dialogue, is he?", 0, 1, 0);
  290. wait(10);
  291.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  292. ChangeText(1, "Nope.", 0, 1, 3);
  293. wait(10);
  294.     while( GetVirtualKeyState(VK_SHOT) != KEY_PUSH) { yield;}
  295.     StopSound(BGM);
  296.     FinishDialogue;
  297. StartScript(Script);
  298.  
  299.  
  300. while(!IsCloseScript(Script) && GetPlayerState() != STATE_END) {
  301.  
  302.     yield;
  303.     }
  304.     wait(240);
  305.     CloseStgScene();
  306. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement