SetSpriteAnimation

Description

Initialises the sprite animation with frames from its assigned image, based on a frame width and frame height. The sprite will use the frame width and frame height to extract images of that size from its assigned image beginning in the top left corner and moving from left to right. When it reaches the right hand side of the image it will begin again one row down, moving from left to right again until the frame count is reached or it runs out of space on the image to look for frames. Storing an animation image on an atlas texture is supported.

This function is the preferred method of assigning an animation to a sprite as it avoids expensive image changes during rendering. However if all your animation frames are separate images you can use the AddSpriteAnimationFrame to add frames from images individually. Using SetSpriteImage will clear all animation frames you have set here.

Definition

SetSpriteAnimation( iSpriteIndex, iFrameWidth, iFrameHeight, iFrameCount )

Parameters