Guest User

Familiar

a guest
Aug 14th, 2013
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. script_enemy_main{
  2.  
  3. let CSD = GetCurrentScriptDirectory;
  4. let imgFam = CSD ~ "system\familiar.png";
  5. let spin = 0;
  6. let FamAngle = GetArgument;
  7. let shot0 = CSD ~ "sfx\se_plst00.wav";
  8.  
  9. @Initialize{
  10. SetLife(10);
  11. LoadGraphic(imgFam);
  12. LoadSE(shot0);
  13. maintask;
  14. }
  15.  
  16. @MainLoop{
  17. yield;
  18. }
  19.  
  20. @DrawLoop{
  21. SetTexture(imgFam);
  22. SetRenderState(ALPHA);
  23. SetAlpha(255);
  24. SetGraphicRect(0,0,48,48);
  25. SetGraphicScale(1,1);
  26. SetGraphicAngle(0,0,spin);
  27.  
  28. if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){ SetGraphicRect(0,48,48,96);}
  29. else{ SetGraphicRect(0,0,48,48);}
  30.  
  31. DrawGraphic(GetX,GetY);
  32. spin+=10;
  33. }
  34.  
  35. @Finalize{
  36. DeleteGraphic(imgFam);
  37. DeleteSE(shot0);
  38. }
  39.  
  40. task maintask{
  41. yield;
  42. fire;
  43. movement;
  44. }
  45.  
  46. task fire{
  47. let dir = rand(0,359);
  48. loop{
  49. CreateShot01(GetX,GetY,1,dir,RED01,10);
  50. // PlaySE(shot0);
  51. dir+=30;
  52. wait(5);
  53. }
  54. }
  55.  
  56. //moves the familiar past the player
  57. task movement{
  58. SetAngle(GetAngleToPlayer+FamAngle);
  59. SetSpeed(6);
  60. }
  61.  
  62. function wait(w){ loop(w){ yield;}}
  63. }
Advertisement
Add Comment
Please, Sign In to add comment