Guest User

"Trailing bullet"

a guest
Nov 9th, 2013
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #TouhouDanmakufu
  2. #ScriptVersion[2]
  3. #Title[Trailing Bullet]
  4. #Text[A trailing bullet]
  5. #Player[FREE]
  6.  
  7. script_enemy_main{
  8.  
  9. @Initialize{
  10. SetLife(1000);
  11. SetMovePosition01(GetCenterX,GetCenterY-100,5);
  12.  
  13. TMain;
  14. }
  15.  
  16. @MainLoop{
  17. yield;
  18. }
  19.  
  20. @DrawLoop{
  21.  
  22. }
  23.  
  24. @Finalize{
  25.  
  26. }
  27.  
  28. task TMain{
  29. wait(120);
  30. TFire;
  31. }
  32.  
  33. task TFire{
  34. loop{
  35. ascent(angle in 0..16){
  36. Bubblebullet(GetEnemyX,GetEnemyY,1,angle*22.5,0.1,BLUE03,30); //fires a bubble bullet that curves and spawns bullets
  37. }
  38. wait(240);
  39. }
  40. }
  41.  
  42. task Bubblebullet(x,y,speed,angle,angularvelocity,graphic,delay){
  43. let obj = Obj_Create(OBJ_SHOT);//creates an object bullet
  44. let count = 0;//counter variable
  45.  
  46. Obj_SetPosition(obj,x,y);//sets posiiton
  47. Obj_SetSpeed(obj,speed);//sets speed
  48. Obj_SetAngle(obj,angle);//sets angle
  49. ObjShot_SetGraphic(obj,graphic);//sets graphic
  50. ObjShot_SetDelay(obj,delay);//sets delay
  51.  
  52. while(!Obj_BeDeleted(obj)){//while the object is not deleted, do...
  53. Obj_SetAngle(obj,Obj_GetAngle(obj)+angularvelocity);//increase the angle by a small amount, making the bullet curve.
  54.  
  55. if(count==30){
  56. CreateShotA(0,Obj_GetX(obj),Obj_GetY(obj),15);//a bullet that spawns without moving, then gradually accelerates.
  57. SetShotDataA(0,0,0,rand(0,359),0,0,0,RED01);
  58. SetShotDataA(0,60,0,NULL,0,0.01,2,RED01);
  59.  
  60. FireShot(0);
  61. count = 0;
  62. }
  63.  
  64. count++;
  65. yield;
  66. }
  67. }
  68.  
  69. function wait(w){ loop(w){ yield;}}
  70. }
Advertisement
Add Comment
Please, Sign In to add comment