Guest User

enemy script

a guest
Nov 17th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. //script for Orb "enemy"
  2.  
  3. script_enemy_main {
  4.  
  5. let arg=GetArgument;
  6. let CSD = GetCurrentScriptDirectory;
  7. let img1=CSD ~ "green_orb.png";
  8. let img2=CSD ~ "red_orb.png";
  9.  
  10. task MainTask{
  11. loop{
  12. SetAngle(rand_int(-15,15));
  13. wait(20);
  14. yield;
  15. }
  16. }
  17.  
  18. @Initialize{
  19. LoadGraphic(img1);
  20. LoadGraphic(img2);
  21. SetLife(10);
  22. MainTask;
  23. }
  24.  
  25. @MainLoop{
  26. SetCollisionA(GetX, GetY, 24);
  27. SetCollisionB(GetX, GetY, 24);
  28. yield;
  29. }
  30.  
  31. @DrawLoop {
  32. if(arg==1){SetTexture(img1);} // 1 stands for green orb
  33. else{SetTexture(img2);} // 2 (or any other) stands for red
  34. SetGraphicRect(0,0,48,48);
  35. SetGraphicScale(0.5,0.5);
  36. DrawGraphic(GetX,GetY);
  37. }
  38.  
  39. @Finalize {
  40. if(arg==1){CreateItem(ITEM_SCORE,GetX,GetY);}
  41. }
  42.  
  43. function wait(w) {
  44. loop(w){yield;}
  45. }
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment