Advertisement
Eredom

Untitled

Apr 29th, 2015
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.98 KB | None | 0 0
  1. Midboss Script:
  2.  
  3. #include"script/default_system/Default_ShotConst.txt"
  4. #include"script/default_system/Default_Effect.txt"
  5. #include"script/ShatteredSky/SYSTEM/common_enemy.dnh"
  6. #include"script/ShatteredSky/SYSTEM/common_enemy_boss.dnh"
  7. @Event{
  8. alternative(GetEventType())
  9. case(EV_REQUEST_LIFE)
  10. {
  11. SetScriptResult(1600);
  12. }
  13. case(EV_REQUEST_TIMER)
  14. {
  15. SetScriptResult(30);
  16. }
  17. }
  18. let F1;
  19. let Mark;
  20. @Initialize
  21. {
  22. F1 = ObjEnemy_Create(OBJ_ENEMY_BOSS);
  23. ObjEnemy_Regist(F1);
  24. ObjEnemy_SetDamageRate(F1,100,100);
  25. ObjEnemy_SetLife(F1,1600);
  26. Work;
  27. Render;
  28. Move;
  29. Marker;
  30. End;
  31. }
  32. @MainLoop
  33. {
  34. let ex = ObjMove_GetX(F1);
  35. let ey = ObjMove_GetY(F1);
  36. ObjEnemy_SetIntersectionCircleToShot(F1,ex,ey,10);
  37. ObjEnemy_SetIntersectionCircleToPlayer(F1,ex,ey,5);
  38. yield;
  39. }
  40.  
  41. task Move{
  42. ObjMove_SetPosition(F1,50,-25);
  43. loop{
  44. ObjMove_SetDestAtFrame(F1, 250, 120, 60);
  45. wait(240);
  46. ObjMove_SetDestAtFrame(F1, 100, 120, 60);
  47. wait(120);
  48. ObjMove_SetDestAtFrame(F1, 175, 70, 60);
  49. wait(120);
  50. }
  51. }
  52. task Work{
  53. wait(90);
  54. while(!Obj_IsDeleted(F1))
  55. {
  56. let loopNr = 1;
  57. let frame = 20;
  58. let px = GetPlayerX();
  59. let py = GetPlayerY();
  60. let ex = ObjMove_GetX(F1);
  61. let ey = ObjMove_GetY(F1);
  62. let angleToPlayer = atan2(py - ey, px - ex);
  63. let rnd = rand_int(-10,10);
  64. loop (12){
  65. loop(4){
  66. let ang1 = angleToPlayer-90-rnd;
  67. let ang2 = angleToPlayer+90+rnd;
  68. let Shot1 = CreateShotA1(ex,ey,7*loopNr,ang1,DS_ICE_BLUE, 2);
  69. let Shot2 = CreateShotA1(ex,ey,7*loopNr,ang2,DS_ICE_BLUE, 2);
  70. ObjMove_AddPatternA2(Shot1, 10,0,ang1+90,0,0,0);
  71. ObjMove_AddPatternA2(Shot2, 10,0,ang2-90,0,0,0);
  72. ObjMove_AddPatternA2(Shot1, 50,0,ang1+90,0.3,1,2);
  73. ObjMove_AddPatternA2(Shot2, 50,0,ang2-90,0.3,-1,2);
  74. ObjMove_AddPatternA2(Shot1, 80,0,NO_CHANGE,0.3,0,2);
  75. ObjMove_AddPatternA2(Shot2, 80,0,NO_CHANGE,0.3,0,2);
  76. loopNr++;
  77. }
  78. loopNr = 0;
  79. wait(5);
  80. }
  81. wait(60);
  82. }
  83. }
  84. task Render{
  85.  
  86. let imgEnemy = GetCurrentScriptDirectory ~ "/img/cirno2.png";
  87. ObjPrim_SetTexture(F1, imgEnemy);
  88. ObjSprite2D_SetSourceRect(F1, 0, 0, 35, 55);
  89. ObjSprite2D_SetDestCenter(F1);
  90. }
  91. task Marker{
  92. let Marker = "script/ShatteredSky/SYSTEM/img/EnemyMarker.png";
  93. Mark = ObjPrim_Create(OBJ_SPRITE_2D);
  94. ObjPrim_SetTexture(Mark, Marker);
  95. Obj_SetRenderPriority(Mark, 20);
  96. let ex = ObjMove_GetX(F1);
  97. ObjSprite2D_SetSourceRect(Mark, 0, 0, 50, 16);
  98. ObjSprite2D_SetDestCenter(Mark);
  99. while(!Obj_IsDeleted(F1)){
  100. ex = ObjMove_GetX(F1);
  101. ObjRender_SetX(Mark, ex+23);
  102. ObjRender_SetY(Mark, 470);
  103. ObjRender_SetZ(Mark,3);
  104. yield;
  105. }
  106. }
  107.  
  108. task End
  109. {
  110. while(ObjEnemy_GetInfo(F1, INFO_LIFE) > 0)
  111. {
  112. yield;
  113. }
  114.  
  115. let ex = ObjMove_GetX(F1);
  116. let ey = ObjMove_GetY(F1);
  117. PlaySFX("/Enemy/ExplosionBoss(PH).wav", 20);
  118. loop(10){
  119. DieAnimationBoss(ex,ey);
  120. }
  121. Obj_Delete(F1);
  122. Obj_Delete(Mark);
  123. DeleteShotAll(TYPE_ALL, TYPE_ITEM);
  124. loop(300){
  125. DeleteShotAll(TYPE_ALL, TYPE_ITEM);
  126. yield;
  127. }
  128.  
  129. CloseScript(GetOwnScriptID());
  130. }
  131.  
  132. STAGE SCRIPT:
  133.  
  134. // #BGM["script/ShatteredSky/snd/BGM/S1_Road.ogg"]
  135. #include"script/ShatteredSky/SYSTEM/common_enemy.dnh"
  136. #include"script/ShatteredSky/SYSTEM/System.dnh"
  137. #include"script/ShatteredSky/Stg/Normal/EnemySt1/Dialogue1.txt"
  138. let LoadComplete = false;
  139. let BGMPath = "script/ShatteredSky/snd/BGM/S1_Road.ogg";
  140. let objBGM = ObjSound_Create;
  141. @Initialize
  142. {
  143. displayPlayerLife;
  144. DelShotifDeath;
  145. LoadSound(BGMPath);
  146. TaskStage1();
  147. }
  148.  
  149. @MainLoop
  150. {
  151. yield;
  152. }
  153.  
  154. @Finalize
  155. {
  156. }
  157.  
  158.  
  159. task TaskStage1
  160. {
  161. yield;
  162. let dir = GetCurrentScriptDirectory();
  163. let En1 = dir ~ "EnemySt1/EnemySt1_1a.txt";
  164. let En2 = dir ~ "EnemySt1/EnemySt1_1b.txt";
  165. let En2v = dir ~ "EnemySt1/EnemySt1_1bVortex.txt";
  166. let En3 = dir ~ "EnemySt1/EnemySt1_1c.txt";
  167. //cut here to make paste smaller
  168. let idScript130 = LoadScriptInThread(En7);
  169. let idScript131 = LoadScriptInThread(En7);
  170. let idScript132 = LoadScriptInThread(En7);
  171. wait(5);
  172. Music;
  173. wait(40);
  174. DifficultySplash;
  175. wait(40);
  176. ItemBorderLine;
  177. wait(40);
  178. StartScript(idScript);
  179. wait(15);
  180.  
  181. //cut here to make paste smaller
  182. wait(10);
  183. StartScript(idScript85);
  184. wait(10);
  185. StartScript(idScript86);
  186. wait(90);
  187. StartScript(idScript88);
  188. StartScript(idScript87);
  189. wait(450);
  190. DeleteShotAll(TYPE_ALL, TYPE_ITEM);
  191. StartScript(idScriptMid);
  192. while(!IsCloseScript(idScriptMid) && GetPlayerState() != STATE_END)
  193. {
  194. yield;
  195. }
  196. wait(120);
  197. StartScript(idScript89);
  198. StartScript(idScript90);
  199. wait(25);
  200. //cut here to make paste smaller
  201. StartScript(idScript118);
  202. wait(25);
  203. StartScript(idScript119);
  204. wait(25);
  205. StartScript(idScript120);
  206. wait(240);
  207. SetForbidPlayerShot(true);
  208. SetForbidPlayerSpell(true);
  209. StartDialogue;
  210. }
  211.  
  212. task ItemBorderLine{
  213. //removed to make paste smaller
  214. }
  215.  
  216. task DifficultySplash{
  217. let DiffSplash = GetCurrentScriptDirectory ~ "EnemySt1/img/NormalSplash.png";
  218. let Diffy = ObjPrim_Create(OBJ_SPRITE_2D);
  219. Obj_SetRenderPriority(Diffy,20);
  220. ObjPrim_SetTexture(Diffy,DiffSplash);
  221. ObjSprite2D_SetSourceRect(Diffy, 0, 0, 70, 20);
  222. ObjSprite2D_SetDestRect(Diffy, 190, 25, 260, 45);
  223. let alp1 = 0;
  224. loop(25){
  225. ObjRender_SetAlpha(Diffy,alp1);
  226. loop(10){alp1++;}
  227. yield;
  228. }
  229. ObjRender_SetAlpha(Diffy,255);
  230. wait(120);
  231. loop(25){
  232. ObjRender_SetAlpha(Diffy,0);
  233. wait(1);
  234. ObjRender_SetAlpha(Diffy,255);
  235. wait(1);
  236. }
  237. ObjRender_SetAlpha(Diffy,0);
  238. ObjSprite2D_SetDestRect(Diffy, 500, 5, 570, 25);
  239. ObjRender_SetAlpha(Diffy,255);
  240. }
  241.  
  242. task Music{
  243. PlayMusic(100);
  244. let MSplash = "script/ShatteredSky/img/BGM/S1_Road.png";
  245. let MSpla = ObjPrim_Create(OBJ_SPRITE_2D);
  246. ObjPrim_SetTexture(MSpla,MSplash);
  247. ObjSprite2D_SetSourceRect(MSpla, 0, 0, 300, 21);
  248. ObjSprite2D_SetDestCenter(MSpla);
  249. ObjSprite2D_SetDestRect(MSpla, 100, 426, 400, 447);
  250. let alp1 = 0;
  251. loop(20){
  252. ObjRender_SetAlpha(MSpla,alp1);
  253. loop(10){alp1++;}
  254. yield;
  255. }
  256. wait(250);
  257. loop(20){
  258. ObjRender_SetAlpha(MSpla,alp1);
  259. loop(10){alp1--;}
  260. yield;
  261. }
  262. ObjRender_SetAlpha(MSpla,0);
  263. }
  264.  
  265. Part of an enemy script (they all work the same):
  266. task End
  267. {
  268. while(ObjEnemy_GetInfo(F1, INFO_LIFE) > 0)
  269. {
  270. yield;
  271. }
  272.  
  273. let ex = ObjMove_GetX(F1);
  274. let ey = ObjMove_GetY(F1);
  275. PlaySFX("/Enemy/ExplosionNormal(PH).wav", 75);
  276. loop(5){
  277. DieAnimation(ex, ey);
  278. }
  279. Obj_Delete(F1);
  280.  
  281. loop(240) { yield; }
  282.  
  283. CloseScript(GetOwnScriptID());
  284. }
  285.  
  286. Task PlaySFX(located in common_enemy.dnh)
  287.  
  288. task PlaySFX(name, Volume){
  289. let SFXPath = "script/ShatteredSky/snd/SFX";
  290. let objSound = ObjSound_Create;
  291. ObjSound_SetSoundDivision(objSound,SOUND_SE);
  292. ObjSound_Load(objSound,SFXPath ~ name);
  293. ObjSound_SetVolumeRate(objSound,Volume);
  294. ObjSound_Play(objSound);
  295. loop(240) { yield; }
  296. // Obj_Delete(objSound);
  297. }
  298.  
  299. Task PlayMusic (located in my own system.dnh)
  300.  
  301. task PlayMusic(Volume){
  302. ObjSound_SetVolumeRate(objBGM,Volume);
  303. ObjSound_SetSoundDivision(objBGM,SOUND_BGM);
  304. ObjSound_SetRestartEnable(objBGM, true);
  305. ObjSound_SetLoopEnable(objBGM, true);
  306. ObjSound_SetLoopTime(objBGM, 1,204);
  307. ObjSound_Play(objBGM);
  308. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement