Class: Engine::Components::SpriteAnimator

Inherits:
Engine::Component show all
Defined in:
lib/engine/components/sprite_animator.rb

Instance Attribute Summary collapse

Attributes inherited from Engine::Component

#game_object

Instance Method Summary collapse

Methods inherited from Engine::Component

#_erase!, #destroy, #destroy!, #destroyed?, destroyed_components, erase_destroyed_components, method_added, #renderer?, #set_game_object, #ui_renderer?

Methods included from Serializable

allowed_class?, get_class, included, register_class, #uuid

Instance Attribute Details

#frame_rateObject (readonly)

Returns the value of attribute frame_rate.



7
8
9
# File 'lib/engine/components/sprite_animator.rb', line 7

def frame_rate
  @frame_rate
end

#loopObject (readonly)

Returns the value of attribute loop.



7
8
9
# File 'lib/engine/components/sprite_animator.rb', line 7

def loop
  @loop
end

Instance Method Details

#awakeObject



9
10
11
12
# File 'lib/engine/components/sprite_animator.rb', line 9

def awake
  @frame_rate ||= 1
  @loop = true if @loop.nil?
end

#startObject



14
15
16
17
# File 'lib/engine/components/sprite_animator.rb', line 14

def start
  @start_time = Time.now
  update_frame
end

#update(delta_time) ⇒ Object



19
20
21
# File 'lib/engine/components/sprite_animator.rb', line 19

def update(delta_time)
  update_frame
end