Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. script_enemy_main{
  2.  
  3. let CSD = GetCurrentScriptDirectory;
  4. let enemy = CSD ~ "system/fairies.png";
  5. let f = 0;
  6. let f2 = 0;
  7. let sfx1 = CSD ~ "sfx/Shot1.wav";
  8.  
  9. @Initialize{
  10. SetLife(10);
  11. LoadGraphic(enemy);
  12. LoadSE(sfx1);
  13.  
  14. mainTask;
  15. }
  16.  
  17. @MainLoop{
  18. yield;
  19. }
  20.  
  21. @DrawLoop{
  22.  
  23. SetTexture(enemy);
  24. SetRenderState(ALPHA);
  25. SetAlpha(255);
  26. SetGraphicScale(1,1);
  27. SetGraphicAngle(0,0,0);
  28.  
  29. if(int(GetSpeedX())==0){
  30. if(f<10){ SetGraphicRect(0,0,30,27); }
  31. if(f>=10 && f<20){ SetGraphicRect(30,0,60,27); }
  32. if(f>=20 && f<30){ SetGraphicRect(60,0,90,27); }
  33. if(f>=30 && f<40){ SetGraphicRect(90,0,120,27); }
  34. if(f>=40 && f<50){ SetGraphicRect(120,0,150,27); }
  35. f2=0;
  36. }
  37.  
  38.  
  39. if(GetSpeedX()>0){
  40. if(f2<5){ SetGraphicRect(150,0,180,27); }
  41. if(f2>=5 && f2<10){ SetGraphicRect(180,0,210,27); }
  42. if(f2>=10 && f2<15){ SetGraphicRect(210,0,240,27); }
  43. if(f2>=15 && f2<20){ SetGraphicRect(240,0,270,27); }
  44. if(f2<20 && f2<25){ SetGraphicRect(300,0,330,27); }
  45. if(f2>=25 && f2<30){ SetGraphicRect(360,0,390,27); }
  46. if(f2>=30 && f2<35){ SetGraphicRect(420,0,450,27); }
  47. if(f2>=40 && f2<45){ SetGraphicRect(450,0,480,27); }
  48. f2++;
  49. }
  50.  
  51.  
  52. if(GetSpeedX()<0){
  53. SetGraphicAngle(180,0,0);
  54. if(f2<5){ SetGraphicRect(150,0,180,27); }
  55. if(f2>=5 && f2<10){ SetGraphicRect(180,0,210,27); }
  56. if(f2>=10 && f2<15){ SetGraphicRect(210,0,240,27); }
  57. if(f2>=15 && f2<20){ SetGraphicRect(240,0,270,27); }
  58. if(f2<20 && f2<25){ SetGraphicRect(300,0,330,27); }
  59. if(f2>=25 && f2<30){ SetGraphicRect(360,0,390,27); }
  60. if(f2>=30 && f2<35){ SetGraphicRect(420,0,450,27); }
  61. if(f2>=40 && f2<45){ SetGraphicRect(450,0,480,27); }
  62. f2++;
  63. }
  64.  
  65. DrawGraphic(GetX,GetY);
  66.  
  67. f++;
  68. if(f==40){f=0;}
  69.  
  70.  
  71. }
  72.  
  73. }
  74.  
  75. @Background{
  76.  
  77. }
  78.  
  79. @Finalize{
  80. DeleteGraphic(enemy);
  81. DeleteSE(sfx1);
  82. }
  83.  
  84. task mainTask{
  85. move;
  86. }
  87.  
  88. task move{
  89. loop(5){
  90. wait(60);
  91. atk;
  92. }
  93. }
  94.  
  95. task atk{
  96. let x = 0;
  97. let dir = 0;
  98. loop(5){
  99. PlaySE(sfx1);
  100. while(x<36){
  101. CreateShotA(1,GetEnemyX,GetEnemyY,10);
  102. SetShotDataA(1,0,1,dir,0,0.1,4,AQUA01);
  103. FireShot(1);
  104. dir+=360/24;
  105. x++;
  106. }
  107. x = 0;
  108. dir = 0;
  109. wait(5);
  110.  
  111. yield;
  112.  
  113.  
  114. }
  115. }
  116.  
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement