Class: Zyps::ApproachAction

Inherits:
TimedAction show all
Defined in:
lib/zyps/actions.rb

Overview

Approaches the target, but obeys law of inertia.

Instance Attribute Summary

Attributes inherited from TimedAction

#clock, #rate

Attributes inherited from Action

#started

Instance Method Summary collapse

Methods inherited from TimedAction

#copy, #delta, #initialize, #start, #stop

Methods inherited from Action

#copy, #initialize, #start, #started?, #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.



106
107
108
109
110
111
112
# File 'lib/zyps/actions.rb', line 106

def do(actor, targets)
	#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