Sprite Animation API

Function CreateSpriteAnimation(sprite, anim_length, speed)

Returns a new sprite animation id.

  • anim_length - number of frames in the animation.
  • speed - frames per second for the animation.

Sub SetSpriteFrame(sprite, frame)

Sets a sprite to a frame in its frame sheet.


Function GetSpriteFrame(sprite)

Returns the current frame in a sprite’s source that it’s on in its animation.


Sub SetSpriteAnimationFrame(sprite, animation, anim_frame, frame)

Sets a frame in a sprite animation.


Function GetSpriteAnimationFrame(sprite, animation, anim_frame)

Returns the frame index in the image source that is set to anim_frame in a sprite’s animation.


Sub SetSpriteAnimationLength(sprite, animation, anim_length)

Sets the number of frames in a sprite animation.


Function GetSpriteAnimationLength(sprite, animation)

Returns the number of frames in a sprite animation.


Sub SetSpriteAnimationSpeed(sprite, animation, speed)

Sets the speed in frames per second for a sprite animation.


Function GetSpriteAnimationSpeed(sprite, animation)

Returns the frames per second of a sprite animation.


Sub SetSpriteAnimation(sprite, animation, num_loops)

Sets the current animation for a sprite Note: Once an animation is set, it will automatically start.


Function GetSpriteAnimation(sprite)

Returns the current animation set on a sprite.


Function GetSpriteCurrentAnimationFrame(sprite)

Returns the current frame of a sprite’s animation.


Function NumSpriteAnimationLoops(sprite)

Returns the number of animation loops the actor has set.

See also

SetSpriteAnimationLoops(), SetSpriteAnimation()


Function SpriteAnimationIsPlaying(sprite)

Returns true if there is an animation playing on the sprite.


Sub DeleteSpriteAnimation(sprite, animation)

Delete’s a sprite’s animation.


Function GetSpriteAnimationSource(sprite, animation)

Returns the image associated with the given sprite animation.