Class: MovieMaker::Action::Rotate

Inherits:
SpriteAction show all
Defined in:
lib/movie_maker/action.rb

Overview

ROTATE

Instance Attribute Summary collapse

Attributes inherited from SpriteAction

#background, #image, #screen, #sprite, #start_at, #stop_at

Instance Method Summary collapse

Methods inherited from SpriteAction

#finalized?, #playing?, #started?

Constructor Details

#initialize(options = {}, angle = 360) ⇒ Rotate

Returns a new instance of Rotate.



139
140
141
142
# File 'lib/movie_maker/action.rb', line 139

def initialize(options = {}, angle = 360)
	super(options)
	@angle = angle
end

Instance Attribute Details

#directionObject (readonly)

Returns the value of attribute direction.



138
139
140
# File 'lib/movie_maker/action.rb', line 138

def direction
  @direction
end

Instance Method Details

#finalizeObject



155
156
157
158
# File 'lib/movie_maker/action.rb', line 155

def finalize
	@sprite.angle = @angle
	@finalized = true
end

#setupObject



144
145
146
147
148
# File 'lib/movie_maker/action.rb', line 144

def setup
	@angle_step = @angle.to_f / @duration.to_f
	@angle_step = -@angle_step 	if @framework == :rubygame
	@setup_done = true
end

#update(time) ⇒ Object



150
151
152
153
# File 'lib/movie_maker/action.rb', line 150

def update(time)
	setup	unless @setup_done
	@sprite.angle = (@angle_step * time)
end