PlaySprite

Family: Sprite · 4 forms

What it does

PlaySprite makes something happen at once: it plays. It takes iSpriteIndex (an integer), and returns nothing. That is the first of 4 forms. iSpriteIndex is the id of a Sprite object, the one CreateSprite returned: it is how the call knows what to act on.

Syntax

1
PlaySprite(iSpriteIndex integer)
2
PlaySprite(iSpriteIndex integer, fFps float)
3
PlaySprite(iSpriteIndex integer, fFps float, iLoop integer)
4
PlaySprite(iSpriteIndex integer, fFps float, iLoop integer, iFromFrame integer, iToFrame integer)

Parameters

NameTypeIn forms
iSpriteIndexintegerall
fFpsfloat2, 3, 4
iLoopinteger3, 4
iFromFrameinteger4
iToFrameinteger4

Every form returns

nothing

Example · generated

Form 1, the short one

image = LoadImage("assets/sprite.png", 1)sprite = CreateSprite(image)PlaySprite(sprite)DO  Sync()LOOP

Form 4, with every argument

image = LoadImage("assets/sprite.png", 1)sprite = CreateSprite(image)PlaySprite(sprite, 1.0, 1, 1, 1)DO  Sync()LOOP

LoadImage and CreateSprite are there to give the call something to act on; PlaySprite is the line that matters. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

135 commands in Sprite