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) → integer2
LoadSprite(iSpriteIndex integer, imagefile string)Parameters
| Name | Type | In forms |
|---|---|---|
| imagefile | string | all |
| iSpriteIndex | integer | 2 |
What each form returns
| 1 | sprite = LoadSprite("assets/sprite.png") | integer |
| 2 | LoadSprite(1, "assets/sprite.png") | nothing |
Example · generated
Form 1, the command hands back the id
sprite = LoadSprite("assets/sprite.png")DO Sync()LOOPForm 2, you choose the id yourself
LoadSprite(1, "assets/sprite.png")DO Sync()LOOPLoadSprite 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.