codingOL

[WIP] babby's first dmf

Sep 30th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.57 KB | None | 0 0
  1. // header
  2. #東方弾幕風[Single]
  3. #ScriptVersion[3]
  4. #Title["テスト「ダークネス」"]
  5. #Text["azaka`crossのはじめのスペカー"]
  6.  
  7. // include files
  8. #include"script/default_system/Default_ShotConst.txt"
  9. #include"script/default_system/Default_Effect.txt"
  10.  
  11. // globs
  12. let objEnemy;
  13. let inMotion = false;
  14.  
  15. @Initialize
  16. {
  17. objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS); // generates boss obj
  18. ObjEnemy_Regist(objEnemy); // Sets objEnemy to active
  19. ObjEnemy_SetDamageRate(objEnemy, 50, 75); // 50% dmg from bullets, 75% dmg from bomb
  20.  
  21. // Load important tasks here
  22. // Tasks are "microthreads" which perform independently of one another
  23. // Using the yield; command in a task suspends it, when placed in loop(n) { }
  24. // It will suspend for n frames.
  25.  
  26. TWork;
  27. TEnemDraw;
  28. TFinish;
  29.  
  30. }
  31.  
  32. @MainLoop
  33. {
  34. let enemyX = ObjMove_GetX(objEnemy);
  35. let enemyY = ObjMove_GetY(objEnemy);
  36.  
  37. // Enemy collision to bullets
  38. ObjEnemy_SetIntersectionCircleToShot(objEnemy, enemyX, enemyY, 32);
  39.  
  40. // Enemy collision to player chara
  41. ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, enemyX, enemyY, 24);
  42.  
  43. yield; // Allows all tasks to perform their job before repeating @MainLoop
  44. }
  45.  
  46. @Event
  47. {
  48. alternative(GetEventType())
  49. case(EV_REQUEST_LIFE)
  50. {
  51. SetScriptResult(250) // Set eHP to 500
  52. }
  53. case(EV_REQUEST_TIMER)
  54. {
  55. SetScriptResult(120) // Set timer to 120s
  56. }
  57. case(EV_REQUEST_SPELL_SCORE)
  58. {
  59. SetScriptResult(50000) // Set score get to 50k
  60. }
  61. }
  62.  
  63. /*******
  64. * Tasks
  65. ********/
  66.  
  67. // Power task, performing the bulk
  68.  
  69. task TWork
  70. {
  71. let stgX = GetStgFrameWidth() / 2; // Obtains the X coordinate of the center of the stage
  72.  
  73. /*******
  74. * Parameters:
  75. * real: object id ,
  76. * real: X-coordinate (in this example, X coord of the center) ,
  77. * real: Y-coordinate (in this example, 60 pixels below (stgX,0)) ,
  78. * real: the frame the object should be placed in (stgX, 60)
  79. ********/
  80. ObjMove_SetDestAtFrame(objEnemy, stgX, 60, 60);
  81.  
  82. loop(60) { yield; } // Suspend this task for 60 frames or 1 second
  83.  
  84. // Performs spell card activation
  85. let objScene = GetEnemyBossSceneObjectID();
  86. ObjEnemyBossScene_StartSpell(objScene);
  87.  
  88. // Perform this while the enemy isn't dead yet
  89. while(!Obj_IsDeleted(objEnemy))
  90. {
  91. // Danmaku processing goes here.
  92. }
  93. }
  94.  
  95. // Drawing task
  96.  
  97. task TEnemDraw
  98. {
  99. let imgExRumia = GetCurrentScriptDirectory ~ "ExRumia.png";
  100. ObjPrim_SetTexture(objEnemy, imgExRumia); // Set exrumia.png as texture to objEnemy
  101.  
  102. while(!Obj_IsDeleted(objEnemy)) // perform this while the enemy isn't dead yet
  103. {
  104. let angle = ObjMove_GetAngle(objEnemy);
  105. let speed = ObjMove_GetSpeed(objEnemy);
  106.  
  107. if(speed == 0) // Only perform this entire block if Rumia's speed was 0
  108. {
  109. if(inMotion) // Perform this block if Rumia was in motion
  110. {
  111. /**************************
  112. * Parameters - Takes only ONE texture image:
  113. * real: object's id ,
  114. * real: lower-left point ,
  115. * real: upper-left point ,
  116. * real: upper-right point ,
  117. * real: lower-right point
  118. **************************/
  119. ObjSprite2D_SetSourceRect(objEnemy, 64, 1, 127, 64);
  120. }
  121. else // Otherwise, make her appear stationary.
  122. {
  123. ObjSprite2D_SetSourceRect(objEnemy, 1, 1, 64, 64);
  124. }
  125. }
  126. // positive value = move right, so make Rumia's body go right
  127. else if (cos(angle) > 0) { ObjSprite2D_SetSourceRect(objEnemy, 192, 1, 255, 64); }
  128. // negative value = move left, so make Rumia's body go left
  129. else if (cos(angle) < 0) { ObjSprite2D_SetSourceRect(objEnemy, 128, 1, 191, 64); }
  130.  
  131. ObjSprite2D_SetDestCenter(objEnemy);
  132.  
  133. yield; // This loop performed once per frame
  134. }
  135. }
  136.  
  137. // Bullet routines
  138.  
  139. // Post-fight processing
  140.  
  141. task TFinish
  142. {
  143. // Suspend this task indefinitely as long as enemy is still alive
  144. while(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) > 0)
  145. {
  146. yield;
  147. }
  148.  
  149. let enemyX = ObjMove_GetX(objEnemy);
  150. let enemyY = ObjMove_GetY(objEnemy);
  151.  
  152. /******
  153. * TExplosionA is found in "script/default_system/..."
  154. * Parameters:
  155. * real: X coordinate of the explosion ,
  156. * real: Y coordinate of the explosion ,
  157. * real: "dAlpha" - reduce the brightness of the explosion by this amount
  158. * real: "dScale" - adjust the size of the explosion by this multiplier
  159. ******/
  160. TExplosionA = (enemyX, enemyY, 45, 0.7);
  161.  
  162. DeleteShotAll(TYPE_ALL, TYPE_ITEM); // Get rid of everything
  163. Obj_Delete(objEnemy); // Delete the enemy to kill the loops
  164.  
  165. loop(30) { yield; } // suspend this task for half a second
  166.  
  167. // Don't forget to close the script when it ends!
  168. CloseScript(GetOwnScriptID());
  169. }
Advertisement
Add Comment
Please, Sign In to add comment