Class: Ruby2D::Sprite
- Inherits:
-
Object
- Object
- Ruby2D::Sprite
- Defined in:
- lib/or2d/patches/sprite.rb
Instance Attribute Summary collapse
-
#animations ⇒ Object
readonly
Returns the value of attribute animations.
-
#defaults ⇒ Object
readonly
Returns the value of attribute defaults.
-
#playing ⇒ Object
readonly
Returns the value of attribute playing.
Instance Method Summary collapse
- #default_frame(animation, frame = 0) ⇒ Object
-
#set_explicit_frame(animation, frame = 0) ⇒ Object
Explicitly set the frame of the Sprite.
Instance Attribute Details
#animations ⇒ Object (readonly)
Returns the value of attribute animations.
4 5 6 |
# File 'lib/or2d/patches/sprite.rb', line 4 def animations @animations end |
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults.
4 5 6 |
# File 'lib/or2d/patches/sprite.rb', line 4 def defaults @defaults end |
#playing ⇒ Object (readonly)
Returns the value of attribute playing.
4 5 6 |
# File 'lib/or2d/patches/sprite.rb', line 4 def @playing end |
Instance Method Details
#default_frame(animation, frame = 0) ⇒ Object
15 16 17 18 |
# File 'lib/or2d/patches/sprite.rb', line 15 def default_frame(animation, frame = 0) @defaults[:animation] = animation @defaults[:frame] = frame end |
#set_explicit_frame(animation, frame = 0) ⇒ Object
Explicitly set the frame of the Sprite. The animation hash is expected to be in either of the following formats: { animation_name: [frame_1, frame_2, …] } { animation_name: frame_range } This function will grab the explicit frame index of the given animation and set it.
11 12 13 |
# File 'lib/or2d/patches/sprite.rb', line 11 def set_explicit_frame(animation, frame = 0) _set_explicit_frame(@animations[animation][frame]) end |