sprite library

The sprite library is used to create <sprites>.

Summary
sprite libraryThe sprite library is used to create <sprites>.
Functions
sprite.newSpriteSheetFromDataLoads a sprite sheet from a data file and creates a texture from the associated image file.
sprite.newSpriteSetCreates a new sprite set.
sprite.newSpriteCreates a new sprite.
sprite.add(sprite_set, animation_name, start_frame, frame_count, duration, loop_count )Defines an animation for a given sprite set.

Functions

sprite.newSpriteSheetFromData

function sprite.newSpriteSheetFromData(file)

Loads a sprite sheet from a data file and creates a texture from the associated image file.

Parameters

fileThe name of the file to load.

Returns

The created sprite sheet.

sprite.newSpriteSet

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.

Parameters

sprite_sheetthe sprite sheet object containing the sprite set
start_framethe first frame of the sprite set
frame_countthe number of frames in the sprite set

See Also

sprite.newSpriteSheetFromData

sprite.newSprite

function sprite.newSprite(sprite_set)

Creates a new sprite.  A sprite sprite is the actual on-screen object representing on or more frames in a sprite set.

Parameters

sprite_setthe sprite set object containing the sprite

See Also

sprite.newSpriteSet

sprite.add(sprite_set, animation_name, start_frame, frame_count, duration, loop_count )

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.

Parameters

sprite_setthe sprite set object containing the sprite
animation_namethe name of the animation.
start_framethe first frame of the animation
frame_countthe number of frames in the animation
frame_durationthe duration of on frame in the animation, e.g., 0.1 for 10 fps
loop_countthe number of times the animation should loop.
  • loop_count = 0, loop forever.
  • loop_count >= 1, loop loop_count times.
  • loop_count = -1, see-saw back and forth once.
  • loop_count < -1, see-saw back and forth forever.
function sprite.newSpriteSheetFromData(file)
Loads a sprite sheet from a data file and creates a texture from the associated image file.
function sprite.newSpriteSet(sprite_sheet,
start_frame,
frame_count)
Creates a new sprite set.
function sprite.newSprite(sprite_set)
Creates a new sprite.
function sprite.add(sprite_set,
animation_name,
start_frame,
frame_duration,
loop_count)
Defines an animation for a given sprite set.
Close