Advertisement
Guest User

Archery Script

a guest
May 11th, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. /**
  2. Archery
  3. For bow practise.
  4.  
  5. @author Armin
  6. */
  7.  
  8. public func IsProjectileTarget(object target, object shooter)
  9. {
  10. // Don't be a target if the arrow comes from the wrong direction.
  11. if (target->GetXDir() < 0 && GetDir() == DIR_Left)
  12. return false;
  13. if (target->GetXDir() > 0 && GetDir() == DIR_Right)
  14. return false;
  15. // Only be a target for the actual target and not the frame.
  16. var dx = target->GetX() - GetX();
  17. var dy = target->GetY() - GetY();
  18. if (Abs(dy + 5) > 13)
  19. return false;
  20. if (GetDir() == DIR_Left)
  21. dx = -dx;
  22. if (dx > dy + 23)
  23. return false;
  24. return true;
  25. }
  26.  
  27. private func Initialize()
  28. {
  29. this.MeshTransformation = Trans_Rotate(20, 0, 1, 0);
  30. SetAction("Stand");
  31. if (!Random(2))
  32. SetDir(DIR_Left);
  33. else
  34. SetDir(DIR_Right);
  35. return;
  36. }
  37.  
  38. public func ControlLeft()
  39. {
  40. SetDir(DIR_Left);
  41. }
  42.  
  43. public func ControlRight()
  44. {
  45. SetDir(DIR_Right);
  46. }
  47.  
  48. local ActMap = {
  49. Stand = {
  50. Prototype = Action,
  51. Name = "Stand",
  52. Directions=2,
  53. FlipDir = 1,
  54. NextAction = "Stand",
  55. },
  56. };
  57.  
  58. func Definition(def)
  59. {
  60. SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(-25, 1, 0, 0), Trans_Rotate(40, 0, 1, 0)), def);
  61. }
  62.  
  63. local Name = "$Name$";
  64. local Description = "$Description$";
  65. local Touchable = 1;
  66. local Rebuy = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement