Class: MovieMaker::Action::Velocity
- Inherits:
-
SpriteAction
- Object
- SpriteAction
- MovieMaker::Action::Velocity
- 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
-
#initialize(options = {}, velocity = [0,0]) ⇒ Velocity
constructor
A new instance of Velocity.
- #update(time) ⇒ Object
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( = {}, velocity = [0,0]) super() @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 |