Class: RedBird::Animation::Base
- Inherits:
-
Object
- Object
- RedBird::Animation::Base
- Defined in:
- lib/red_bird/animation.rb
Overview
Base class for different animations. An animation consists of a sequence of frames, a state to define which one to show and which comes next and an animation method to determine how the frames change.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#current_sprite ⇒ RedBird::Sprite
readonly
The sprite for the current stage of the animation.
Instance Method Summary collapse
-
#initialize(frames) ⇒ Base
constructor
A new instance of Base.
-
#reset ⇒ Object
Set this animation to the initial state.
Constructor Details
#initialize(frames) ⇒ Base
Returns a new instance of Base.
48 49 50 51 |
# File 'lib/red_bird/animation.rb', line 48 def initialize(frames) @frames = frames self.set end |
Instance Attribute Details
#current_sprite ⇒ RedBird::Sprite (readonly)
Returns the sprite for the current stage of the animation.
44 45 46 |
# File 'lib/red_bird/animation.rb', line 44 def current_sprite @current_sprite end |
Instance Method Details
#reset ⇒ Object
Set this animation to the initial state.
56 57 58 |
# File 'lib/red_bird/animation.rb', line 56 def reset self.set end |