Class: MovieMaker::Action::Velocity

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

Overview

ACCELERATE

Instance Attribute Summary

Attributes inherited from SpriteAction

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

Instance Method Summary collapse

Methods inherited from SpriteAction

#finalize, #finalized?, #playing?, #setup, #started?

Constructor Details

#initialize(options = {}, velocity = [0,0]) ⇒ Velocity

Returns a new instance of Velocity.



122
123
124
125
126
# File 'lib/movie_maker/action.rb', line 122

def initialize(options = {}, velocity = [0,0])
	super(options)
	@velocity_x = velocity[0]
	@velocity_y = velocity[1]
end

Instance Method Details

#update(time) ⇒ Object



128
129
130
131
# File 'lib/movie_maker/action.rb', line 128

def update(time)
	@sprite.x += @velocity_x
	@sprite.y += @velocity_y
end