What it does
CreateSprite brings a Sprite object into being: it is how the rest of the program comes to have one. It takes iSpriteIndex (an integer) and iImageIndex (an integer), and returns nothing. That is the first of 2 forms. iSpriteIndex is the id you are giving a Sprite object: every later call names it by that number.
Syntax
1
CreateSprite(iSpriteIndex integer, iImageIndex integer)2
CreateSprite(iImageIndex integer) → integerParameters
| Name | Type | In forms |
|---|---|---|
| iSpriteIndex | integer | 1 |
| iImageIndex | integer | all |
What each form returns
| 1 | CreateSprite(1, image) | nothing |
| 2 | sprite = CreateSprite(image) | integer |
Example · generated
Form 1, you choose the id yourself
image = LoadImage("assets/sprite.png", 1)CreateSprite(1, image)DO Sync()LOOPForm 2, the command hands back the id
image = LoadImage("assets/sprite.png", 1)sprite = CreateSprite(image)DO Sync()LOOPLoadImage is there to give the call something to act on; CreateSprite 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.