What it does
LoadSubImage writes to an Image object: it loads rather than reads. It takes iImageIndex (an integer), iParentIndex (an integer) and sImageFilename (a string), and returns nothing. That is the first of 2 forms. iImageIndex is the id you are giving an Image object: every later call names it by that number.
Syntax
1
LoadSubImage(iImageIndex integer, iParentIndex integer, sImageFilename string)2
LoadSubImage(iParentIndex integer, sImageFilename string) → integerParameters
| Name | Type | In forms |
|---|---|---|
| iImageIndex | integer | 1 |
| iParentIndex | integer | all |
| sImageFilename | string | all |
What each form returns
| 1 | LoadSubImage(1, 1, "assets/sprite.png") | nothing |
| 2 | subImage = LoadSubImage(1, "assets/sprite.png") | integer |
Example · generated
Form 1, you choose the id yourself
LoadSubImage(1, 1, "assets/sprite.png")DO Sync()LOOPForm 2, the command hands back the id
subImage = LoadSubImage(1, "assets/sprite.png")DO Sync()LOOPLoadSubImage is called with values of the types its signature asks for. 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.