LoadSprite

Family: Sprite · 2 forms

What it does

LoadSprite writes to a Sprite object: it loads rather than reads. It takes imagefile (a string), and answers an integer. That is the first of 2 forms.

Syntax

1
LoadSprite(imagefile string) → integer
2
LoadSprite(iSpriteIndex integer, imagefile string)

Parameters

NameTypeIn forms
imagefilestringall
iSpriteIndexinteger2

What each form returns

1sprite = LoadSprite("assets/sprite.png")integer
2LoadSprite(1, "assets/sprite.png")nothing

Example · generated

Form 1, the command hands back the id

sprite = LoadSprite("assets/sprite.png")DO  Sync()LOOP

Form 2, you choose the id yourself

LoadSprite(1, "assets/sprite.png")DO  Sync()LOOP

LoadSprite is called and its answer is printed every frame. 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