Class: AniRuby::Frame

Inherits:
Object
  • Object
show all
Defined in:
lib/aniruby/frame.rb

Overview

A frame has a sprite that’s Gosu::Image and a duration specified in milliseconds

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sprite, duration = 0.1) ⇒ Frame

Create a new frame



15
16
17
18
19
20
21
# File 'lib/aniruby/frame.rb', line 15

def initialize(sprite, duration = 0.1)
  @sprite = sprite
  @duration = duration

  @w = @sprite.width
  @h = @sprite.height
end

Instance Attribute Details

#durationObject

Returns the value of attribute duration.



6
7
8
# File 'lib/aniruby/frame.rb', line 6

def duration
  @duration
end

#hObject (readonly)

Returns the value of attribute h.



7
8
9
# File 'lib/aniruby/frame.rb', line 7

def h
  @h
end

#spriteObject

Returns the value of attribute sprite.



6
7
8
# File 'lib/aniruby/frame.rb', line 6

def sprite
  @sprite
end

#wObject (readonly)

Returns the value of attribute w.



7
8
9
# File 'lib/aniruby/frame.rb', line 7

def w
  @w
end