The sprite library is used to create <sprites>.
| sprite library | The sprite library is used to create <sprites>. |
| Functions | |
| sprite. | Loads a sprite sheet from a data file and creates a texture from the associated image file. |
| sprite. | Creates a new sprite set. |
| sprite. | Creates a new sprite. |
| sprite. | Defines an animation for a given sprite set. |
function sprite.newSpriteSet( sprite_sheet, start_frame, frame_count )
Creates a new sprite set. A sprite set is a collection of frame sequences for a particular sprite within a sprite sheet.
| sprite_sheet | the sprite sheet object containing the sprite set |
| start_frame | the first frame of the sprite set |
| frame_count | the number of frames in the sprite set |
function sprite.add( sprite_set, animation_name, start_frame, frame_duration, loop_count )
Defines an animation for a given sprite set. Sprite sets can contain many animations.
| sprite_set | the sprite set object containing the sprite |
| animation_name | the name of the animation. |
| start_frame | the first frame of the animation |
| frame_count | the number of frames in the animation |
| frame_duration | the duration of on frame in the animation, e.g., 0.1 for 10 fps |
| loop_count | the number of times the animation should loop. |
Loads a sprite sheet from a data file and creates a texture from the associated image file.
function sprite.newSpriteSheetFromData( file )
Creates a new sprite set.
function sprite.newSpriteSet( sprite_sheet, start_frame, frame_count )
Creates a new sprite.
function sprite.newSprite( sprite_set )
Defines an animation for a given sprite set.
function sprite.add( sprite_set, animation_name, start_frame, frame_duration, loop_count )