Class: Zyps::ApproachAction
- Inherits:
-
TimedAction
- Object
- Action
- TimedAction
- Zyps::ApproachAction
- Defined in:
- lib/zyps/actions.rb
Overview
Approaches the target, but obeys law of inertia.
Instance Attribute Summary
Attributes inherited from TimedAction
Instance Method Summary collapse
-
#do(actor, targets) ⇒ Object
Accelerate toward the first target, but limited by 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 toward the first target, but limited by rate.
107 108 109 110 111 112 113 114 |
# File 'lib/zyps/actions.rb', line 107 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) ) end |