Class: Zyps::FleeAction
- Inherits:
-
TimedAction
- Object
- Action
- TimedAction
- Zyps::FleeAction
- Defined in:
- lib/zyps/actions.rb
Overview
Flees from the target, but obeys law of inertia.
Instance Attribute Summary
Attributes inherited from TimedAction
Instance Method Summary collapse
-
#do(actor, targets) ⇒ Object
Accelerate away from the first target, but limited by turn rate.
Methods inherited from TimedAction
#copy, #delta, #initialize, #start, #stop
Constructor Details
This class inherits a constructor from Zyps::TimedAction
Instance Method Details
#do(actor, targets) ⇒ Object
Accelerate away from the first target, but limited by turn rate.
121 122 123 124 125 126 127 128 |
# File 'lib/zyps/actions.rb', line 121 def do(actor, targets) return if targets.empty? #Apply thrust to the creature's movement vector, adjusted by elapsed time. actor.vector += Vector.new( delta, Utility.find_angle(actor.location, targets[0].location) + 180 ) end |