Advertisement
Guest User

Obj_Collision_Spellcard

a guest
Jul 25th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. #TouhouDanmakufu
  2. #Title[Spell Card 1]
  3. #Text[Easy Mode.]
  4. #Player[FREE]
  5. #ScriptVersion[2]
  6.  
  7. script_enemy_main{
  8. let CSD = GetCurrentScriptDirectory;
  9. let niceshot = CSD~"\supershot\supershot.txt";
  10. let death = CSD~"BossDeath.wav";
  11. let time01 = CSD~"timeout01.wav";
  12. let time02 = CSD~"timeout02.wav";
  13. let frame = 0;
  14. let ID1 = Obj_Create(OBJ_SHOT);
  15. let spellbg = CSD~"spellbg.png";
  16. let spellbg2 = CSD~"spellbg2.png";
  17. let objarr = [];
  18. let circle = CSD~"Circle.png";
  19. let SE1 = CSD~"Shot1.WAV";
  20. let SE2 = CSD~"Shot4.WAV";
  21. let SE3 = CSD~"se_ch02.WAV";
  22. let booksheet = CSD~"servant.png";
  23. #include_function ".\AnimationLib.dnh"
  24. #include_function ".\FunctionLib.dnh"
  25.  
  26.  
  27. @Initialize{
  28. LoadUserShotData(niceshot);
  29. LoadGraphic(circle);
  30. LoadGraphic(booksheet);
  31. LoadGraphic(spellbg2);
  32. LoadGraphic(spellbg);
  33. SetLife(1000);
  34. SetTimer(60);
  35. SetScore(100000);
  36. SetInvincibility(100);
  37. SetMovePosition03(GetCenterX, GetCenterY-120, 10, 4);
  38. SetDamageRate(10,5);
  39. SetEffectForZeroLife(70,200,1);
  40. mainTask;
  41. SetText("Fire & Water Sign"\""Frozen Rain"\");
  42. IceStorm;
  43. Timer;
  44.  
  45. CreateAnimation("book", "intro", 4);
  46. SetAnimationFrame("book", "intro", 0, booksheet, 12, 0, 2, 31, 30);
  47. SetAnimationFrame("book", "intro", 1, booksheet, 12, 31, 2, 62, 30);
  48. SetAnimationFrame("book", "intro", 2, booksheet, 12, 62, 2, 93, 30);
  49. SetAnimationFrame("book", "intro", 3, booksheet, 12, 93, 2, 124, 30);
  50.  
  51. Animate("book","intro",false);
  52.  
  53. }
  54.  
  55.  
  56. @MainLoop{
  57. yield;
  58. SetCollisionA(GetX,GetY,10);
  59. SetCollisionB(GetX,GetY,15);
  60. if(frame<900){frame++;}
  61. if(frame==800){SetDamageRate(50,50);}
  62. }
  63.  
  64. let circlespin = 0;
  65. let wave = 0;
  66. let float = 0;
  67.  
  68. @DrawLoop{
  69.  
  70. SetTexture(circle);
  71. SetGraphicRect(64,64,192,192);
  72. SetGraphicScale(1+sin(wave)*0.5,1+sin(wave)*0.5);
  73. SetGraphicAngle(0,0,circlespin);
  74. SetAlpha(150);
  75. DrawGraphic(GetX,GetY);
  76. circlespin+=5;
  77. wave+=2;
  78.  
  79. SetTexture(booksheet);
  80. SetGraphicScale(1,1);
  81. SetAlpha(255);
  82. SetGraphicAngle(0,0,0);
  83. DrawAnimatedSprite("book", GetX, GetY+sin(float)*4);
  84. float += (1/((|GetSpeedX|)+1))*3;
  85.  
  86. }
  87.  
  88. @Finalize{
  89. }
  90.  
  91. let bgalpha=0;
  92. let bgalpha2=0;
  93. let bgscroll=0;
  94.  
  95. @BackGround{
  96. if(bgalpha<100){bgalpha+=2;}
  97. if(bgalpha2<70){bgalpha2+=2;}
  98.  
  99. SetTexture(spellbg);
  100. SetGraphicRect(0,0,256,256);
  101. SetGraphicScale(2,2);
  102. SetAlpha(bgalpha);
  103. DrawGraphic(GetCenterX,GetCenterY);
  104.  
  105. SetTexture(spellbg2);
  106. SetGraphicRect(0+bgscroll,0+bgscroll,256+bgscroll,256+bgscroll);
  107. SetGraphicScale(2,2);
  108. SetAlpha(bgalpha2);
  109. DrawGraphic(GetCenterX,GetCenterY);
  110.  
  111. bgscroll+=2;
  112. }
  113.  
  114. task mainTask{
  115. wait(100);
  116. let addangle=0;
  117. loop{
  118. addangle+=46.5;
  119. SetColor(150,0,0);
  120. PlaySE(SE3);
  121. Concentration01(30);
  122. SetColor(255,255,255);
  123. wait(30);
  124. PlaySE(SE1);
  125. ascent(i in 0..10){
  126. FireBullet(5,i*360/10+addangle);}
  127.  
  128. wait(540);
  129. }
  130. }
  131.  
  132.  
  133. task IceStorm{
  134. wait(100);
  135. let wave = 0;
  136. let wave2 = 0;
  137. loop{
  138. PlaySE(SE2);
  139. ascent(i in 0..4){
  140. IceBullet(60+i*GetClipMaxX/4+sin(wave)*50,GetClipMinY,90+sin(wave2)*45);
  141. }
  142. wave+=73.5;
  143. wave2+=23.5;
  144. wait(30);
  145. }
  146. }
  147.  
  148. task FireBullet(speed,angle){
  149. ID1 = Obj_Create(OBJ_SHOT);
  150. objarr = objarr~[ID1]; //Add the object to the global array.
  151.  
  152. Obj_SetPosition(ID1,GetX,GetY);
  153. Obj_SetSpeed(ID1,speed);
  154. Obj_SetAngle(ID1,angle);
  155. Obj_SetCollisionToObject(ID1,true);
  156. ObjShot_SetDelay(ID1,10);
  157. ObjShot_SetGraphic(ID1,237);
  158.  
  159. while(!Obj_BeDeleted(ID1)){
  160.  
  161. yield;
  162.  
  163. }
  164. ascent(i in 0..length(objarr)){ //Go through all objects and remove self
  165. if(objarr[i] == ID1){
  166. objarr = erase(objarr,i);
  167. break;
  168. }
  169. }
  170. }
  171.  
  172. task IceBullet(X,Y,angle){
  173. let ID2 = Obj_Create(OBJ_SHOT);
  174.  
  175. Obj_SetPosition(ID2,X,Y);
  176. Obj_SetSpeed(ID2,3);
  177. Obj_SetAngle(ID2,angle);
  178. Obj_SetCollisionToObject(ID2,true);
  179. ObjShot_SetDelay(ID2,20);
  180. ObjShot_SetGraphic(ID2,205);
  181.  
  182.  
  183. while(!Obj_BeDeleted(ID2)){
  184.  
  185. ascent(i in 0..length(objarr)){ //Go through all objects
  186. if(Collision_Obj_Obj(ID2,objarr[i])){
  187.  
  188. ascent(i in 0..5){
  189. CreateShotA(1,Obj_GetX(ID2),Obj_GetY(ID2),0);
  190. SetShotDataA(1,0,1,i*72,0,0,0,240);
  191. SetShotDataA(1,60,0,90,0,0.1,5,240);
  192. FireShot(1);
  193. }
  194.  
  195. Obj_Delete(ID2);
  196. }}
  197.  
  198. yield;
  199.  
  200. }
  201.  
  202. }
  203.  
  204. task Timer{
  205. loop{
  206. if (GetTimer > 5 && GetTimer <= 11){PlaySE(time01);}
  207. if (GetTimer >= 1 && GetTimer <= 5){PlaySE(time02);}
  208. wait(60);
  209. }
  210. }
  211.  
  212. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement