Class: RedBird::Animation::Base

Inherits:
Object
  • Object
show all
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.

Author:

  • Frederico Linhares

Direct Known Subclasses

BackAndForth, Loop

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(frames) ⇒ Base

Returns a new instance of Base.

Parameters:

  • frames (Array)

    an array of RedBird::Frame.

Author:

  • Frederico Linhares



48
49
50
51
# File 'lib/red_bird/animation.rb', line 48

def initialize(frames)
  @frames = frames
  self.set
end

Instance Attribute Details

#current_spriteRedBird::Sprite (readonly)

Returns the sprite for the current stage of the animation.

Returns:



44
45
46
# File 'lib/red_bird/animation.rb', line 44

def current_sprite
  @current_sprite
end

Instance Method Details

#resetObject

Set this animation to the initial state.

Author:

  • Frederico Linhares



56
57
58
# File 'lib/red_bird/animation.rb', line 56

def reset
  self.set
end