Extended from PhysicalObject Sprite¶
This class is used to play sounds
Properties¶
boolean IsPlaying¶
Indicates if the sprite is playing
number SecondsPerFrame¶
This is the time to wait between frame and frame
table Sprites¶
This table stores all sprite sheets and sprite lists
{ }
table Active¶
This table stores information about the active spritesheet
{
Name: string,
CurrentFrame: Vector2,
SecondsPerFrame: number,
NextStepReady: boolean,
}
Methods¶
Sprite Constructor(
)¶
The second parameter is the size of a cell of every frame of an sprite sheet, this can be changed using the .ImageRectSize property of the object Instance
void SetSpriteSheet(name: string, url: string, frames: Vector2
)¶
Adds a new sprite sheet to the object, the sprite will be played using as reference the amount of cells in the X axe and the Y axe, this must be provided in the third paramether as a Vector2
void SetSpriteList(name: string, list: Array<string>
)¶
Adds a new sprite list to the object, it will play the animation using the order in the provided list, this list must contain the urls of every frame
void Play(name: string, secondsPerFrame: number?
)¶
Plays the specified sprite if exists, if secondsEveryFrame is specified it will be used instead of .SecondsPerFrame
void Stop(
)¶
Stops the reproduction of the current playing sprite sheet or sprite list
Events¶
Name |
Description |
---|---|