Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- Archery
- For bow practise.
- @author Armin
- */
- public func IsProjectileTarget(object target, object shooter)
- {
- // Don't be a target if the arrow comes from the wrong direction.
- if (target->GetXDir() < 0 && GetDir() == DIR_Left)
- return false;
- if (target->GetXDir() > 0 && GetDir() == DIR_Right)
- return false;
- // Only be a target for the actual target and not the frame.
- var dx = target->GetX() - GetX();
- var dy = target->GetY() - GetY();
- if (Abs(dy + 5) > 13)
- return false;
- if (GetDir() == DIR_Left)
- dx = -dx;
- if (dx > dy + 23)
- return false;
- return true;
- }
- private func Initialize()
- {
- this.MeshTransformation = Trans_Rotate(20, 0, 1, 0);
- SetAction("Stand");
- if (!Random(2))
- SetDir(DIR_Left);
- else
- SetDir(DIR_Right);
- return;
- }
- public func ControlLeft()
- {
- SetDir(DIR_Left);
- }
- public func ControlRight()
- {
- SetDir(DIR_Right);
- }
- local ActMap = {
- Stand = {
- Prototype = Action,
- Name = "Stand",
- Directions=2,
- FlipDir = 1,
- NextAction = "Stand",
- },
- };
- func Definition(def)
- {
- SetProperty("PictureTransformation", Trans_Mul(Trans_Rotate(-25, 1, 0, 0), Trans_Rotate(40, 0, 1, 0)), def);
- }
- local Name = "$Name$";
- local Description = "$Description$";
- local Touchable = 1;
- local Rebuy = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement