Class: Zyps::TurnAction

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

Overview

Apply a thrust that turns actor.

Instance Attribute Summary collapse

Attributes inherited from TimedAction

#clock, #rate

Attributes inherited from Action

#started

Instance Method Summary collapse

Methods inherited from TimedAction

#copy, #delta, #start, #stop

Methods inherited from Action

#copy, #start, #started?, #stop

Constructor Details

#initialize(rate, angle) ⇒ TurnAction

Returns a new instance of TurnAction.



90
91
92
93
# File 'lib/zyps/actions.rb', line 90

def initialize(rate, angle)
	super
	@angle = angle
end

Instance Attribute Details

#angleObject

Angle to turn at.



89
90
91
# File 'lib/zyps/actions.rb', line 89

def angle
  @angle
end

Instance Method Details

#do(actor, targets) ⇒ Object



94
95
96
97
98
99
# File 'lib/zyps/actions.rb', line 94

def do(actor, targets)
	actor.vector += Vector.new(
		delta,
		actor.vector.pitch + @angle
	)
end