Class: MovieMaker::Action::SpriteAction
- Inherits:
-
Object
- Object
- MovieMaker::Action::SpriteAction
- Defined in:
- lib/movie_maker/action.rb
Overview
All actions inherit from this base-class and Should call super in their initialize. Takes an option-hash: :start_at - start at X millisec into the movie :stop_at - stop at X millisec into the movie :sprite - the actuall spriteobject, needs to answer to x,x=,y,y= and image :screen - the screenobject, so it knows where to blit itself :background - the backgroundsurface so it can undraw itself properly
Direct Known Subclasses
Acceleration, FadeOut, FadeTo, Move, MoveFacingDirection, Pulsate, Rotate, Show, Velocity, Zoom
Instance Attribute Summary collapse
-
#background ⇒ Object
Returns the value of attribute background.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#screen ⇒ Object
Returns the value of attribute screen.
-
#sprite ⇒ Object
Returns the value of attribute sprite.
-
#start_at ⇒ Object
readonly
Returns the value of attribute start_at.
-
#stop_at ⇒ Object
readonly
Returns the value of attribute stop_at.
Instance Method Summary collapse
- #finalize ⇒ Object
- #finalized? ⇒ Boolean
-
#initialize(options = {}, *ignore) ⇒ SpriteAction
constructor
A new instance of SpriteAction.
- #playing?(current_time) ⇒ Boolean
- #setup ⇒ Object
- #started?(current_time) ⇒ Boolean
Constructor Details
#initialize(options = {}, *ignore) ⇒ SpriteAction
Returns a new instance of SpriteAction.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/movie_maker/action.rb', line 21 def initialize( = {}, *ignore) @sprite = [:object] @background = [:background] @screen = [:screen] @start_at = ([:start_at]||0) * 1000 @stop_at = ([:stop_at]||0) * 1000 @cache = [:cache] || false @framework = [:framework] || :rubygame @duration = @stop_at - @start_at = true @finalized = false @setup_done = false @image = @sprite.image # used in MovieMaker#play end |
Instance Attribute Details
#background ⇒ Object
Returns the value of attribute background.
19 20 21 |
# File 'lib/movie_maker/action.rb', line 19 def background @background end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
20 21 22 |
# File 'lib/movie_maker/action.rb', line 20 def image @image end |
#screen ⇒ Object
Returns the value of attribute screen.
19 20 21 |
# File 'lib/movie_maker/action.rb', line 19 def screen @screen end |
#sprite ⇒ Object
Returns the value of attribute sprite.
19 20 21 |
# File 'lib/movie_maker/action.rb', line 19 def sprite @sprite end |
#start_at ⇒ Object (readonly)
Returns the value of attribute start_at.
20 21 22 |
# File 'lib/movie_maker/action.rb', line 20 def start_at @start_at end |
#stop_at ⇒ Object (readonly)
Returns the value of attribute stop_at.
20 21 22 |
# File 'lib/movie_maker/action.rb', line 20 def stop_at @stop_at end |
Instance Method Details
#finalize ⇒ Object
41 42 43 |
# File 'lib/movie_maker/action.rb', line 41 def finalize @finalized = true end |
#finalized? ⇒ Boolean
45 46 47 |
# File 'lib/movie_maker/action.rb', line 45 def finalized? @finalized end |
#playing?(current_time) ⇒ Boolean
53 54 55 |
# File 'lib/movie_maker/action.rb', line 53 def (current_time) and (current_time >= self.start_at) and (current_time < self.stop_at) end |
#setup ⇒ Object
37 38 39 |
# File 'lib/movie_maker/action.rb', line 37 def setup @setup_done = true end |
#started?(current_time) ⇒ Boolean
49 50 51 |
# File 'lib/movie_maker/action.rb', line 49 def started?(current_time) current_time >= self.start_at end |