Class: Ruby2D::Sprite

Inherits:
Object
  • Object
show all
Defined in:
lib/or2d/patches/sprite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#animationsObject (readonly)

Returns the value of attribute animations.



4
5
6
# File 'lib/or2d/patches/sprite.rb', line 4

def animations
  @animations
end

#defaultsObject (readonly)

Returns the value of attribute defaults.



4
5
6
# File 'lib/or2d/patches/sprite.rb', line 4

def defaults
  @defaults
end

#playingObject (readonly)

Returns the value of attribute playing.



4
5
6
# File 'lib/or2d/patches/sprite.rb', line 4

def playing
  @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