Guest User

Practice with familiars

a guest
Nov 21st, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. #TouhouDanmakufu
  2. #Title[Practice Spellcard]
  3. #Text[Spellcard, with Familiars]
  4. #Player[FREE]//always capitalize FREE
  5. #ScriptVersion[2]
  6.  
  7. script_enemy_main{
  8.  
  9. let CSD = GetCurrentScriptDirectory;
  10. let imgBoss = CSD ~ "img\aki.png";
  11. let cut = CSD ~ "img\cirnocut.png";
  12. let bg = CSD ~ "img\snowbg.png";
  13. let lay = CSD ~ "img\blizzard.png";
  14.  
  15. let f = 0;
  16. let f2 = 0;
  17.  
  18. @Initialize{
  19. SetLife(3000);
  20. SetTimer(70);
  21. SetMovePosition01(GetCenterX, GetCenterY-60,5);
  22. LoadGraphic(imgBoss);
  23. mainTask;
  24. }
  25.  
  26.  
  27. @MainLoop{
  28. SetCollisionA(GetX,GetY,20);
  29. SetCollisionB(GetX,GetY,15);
  30. yield;
  31. }
  32.  
  33.  
  34. @DrawLoop{
  35.  
  36. DrawGraphic(GetX, GetY);
  37. SetTexture(imgBoss);
  38. SetRenderState(ALPHA);
  39. SetAlpha(255);
  40. SetGraphicScale(1,1);
  41. SetGraphicAngle(0,0,0);
  42.  
  43. if(int(GetSpeedX())==0){
  44. if(f<10){SetGraphicRect(0,0,63,63);}
  45. if(f>=10 && f<20){SetGraphicRect(63,0,126,63);}
  46. if(f>=20 && f<30){SetGraphicRect(126,0,189,63);}
  47. if(f>=30 && f<40){SetGraphicRect(189,0,252,63);}
  48. f2=0;
  49. }
  50.  
  51. if(int(GetSpeedX())>0){
  52. if(f2<5){SetGraphicRect(0,63,63,126);}
  53. if(f2>=5 && f2<10){SetGraphicRect(63,63,126,126);}
  54. if(f2>=10 && f2<15){SetGraphicRect(126,63,189,126);}
  55. if(f2>=15){SetGraphicRect(189,63,252,126);}
  56. f2++;
  57. }
  58.  
  59. if(int(GetSpeedX())<0){
  60. SetGraphicAngle(180,0,0);//mirrors set image
  61. if(f2<5){SetGraphicRect(0,63,63,126);}
  62. if(f2>=5 && f2<10){SetGraphicRect(63,63,126,126);}
  63. if(f2>=10 && f2<15){SetGraphicRect(126,63,189,126);}
  64. if(f2>=15){SetGraphicRect(189,63,252,126);}
  65. f2++;
  66. }
  67. DrawGraphic(GetX,GetY);
  68.  
  69. f++;
  70. if(f==40){
  71. f=0;
  72. }
  73. }
  74.  
  75.  
  76. @BackGround{
  77.  
  78.  
  79. }
  80.  
  81.  
  82. @Finalize{
  83. DeleteGraphic(imgBoss);
  84. }
  85.  
  86.  
  87. task mainTask{
  88. wait(90);
  89. yield;
  90. spawn;
  91. }
  92.  
  93.  
  94. sub spawn{
  95. /*space for spawning sound effect
  96. PlaySe(CSD ~ "sfx\spawnfam.wav");
  97. CreateEnemyFromScript("starFam",GetEnemyX,GetEnemyY,0,0,0);
  98. CreateEnemyFromScript("starFam",GetEnemyX,GetEnemyY,0,0,180);
  99. }
  100.  
  101.  
  102. function wait(w){
  103. loop(w){
  104. yield;
  105. }
  106. }
  107. }
  108.  
  109. //Familiars
  110. script_enemy starFam{
  111.  
  112. let CSD = GetCurrentScriptDirectory;
  113. let imgFam = CSD ~ "img\familiar1.png";
  114. let dir = 0;
  115. let r = 80;
  116. let spin = 0;
  117.  
  118. let famAnge = GetArgument;
  119.  
  120. @Initialize{
  121. SetLife(800);
  122. //SetDamageRateEx(taken dmg by shot, by , transferred dmg by shot to boss, bomb to boss);
  123. SetDamageRateEx(25,15,25,15);
  124. LoadGraphic(imgFam);
  125. mainTask;
  126. }
  127.  
  128.  
  129. @MainLoop{
  130. SetCollisionA(GetX,GetY,20);
  131. SetCollisionB(GetX,GetY,20);
  132. yield;
  133. }
  134.  
  135.  
  136. @DrawLoop{
  137. SetTexture(imgFam);
  138. SetRenderState(ALPHA);
  139. SetAlpha(255);
  140. SetGraphicScale(1,1);
  141. SetGraphicAngle(0,0,spin);
  142. SetGraphicRect(0,0,65,67);
  143. DrawGraphic(GetX,GetY);
  144.  
  145. SetTexture(imgFam);
  146. SetRenderState(ALPHA);
  147. SetAlpha(255);
  148. SetGraphicScale(1,1);
  149. SetGraphicAngle(0,0,spin);
  150. SetGraphicRect(0,0,65,67);
  151. DrawGraphic(GetX,GetY);
  152.  
  153. spin-=10;
  154. }
  155.  
  156.  
  157. task mainTask{
  158. yield;
  159. movement;
  160. }
  161.  
  162.  
  163. task movement{
  164. loop{
  165. SetMovePosition3(GetEnemyX+r*cos(dir+famAngle),GetEnemyY+60*sin(dir+famAngle),20,10);
  166. dir++;
  167. yield;
  168. }
  169. }
  170.  
  171.  
  172. @Finalize{
  173. //deletes the image
  174. DeleteGraphic(imgFam);
  175. }
  176. }
Advertisement
Add Comment
Please, Sign In to add comment