Dev - Lua Libraries
Lua Command: s3sprite.create
Parameters
Return Values
- S3Sprite spriteInstance
Signature
S3Sprite spriteInstance = s3sprite.create(int imageID, int x = 0, int y = 0, order order = 0, color color = "white")
Description
Creates a new sprite instance on the screen with the image imageID and returns the spriteInstance for use with other commands. spriteInstance will be NIL if the creation failed (this may happen because imageID does not point to an existing image).
The position is specified in pixels and starts with (0|0) in the top left corner of the screen. This is also the default position. A custom position can be specified with the parameters x and y. It is possible to change the position after creation with commands like s3sprite.setPosition.
The order defines the rendering order (and optionally also the sorting layer). Images with a lower order/sorting layer are rendered first.
Optionally a color and transparency can be defined with color. The default color is white (r,g,b = 255), the default transparency is opaque (alpha 1).
The position is specified in pixels and starts with (0|0) in the top left corner of the screen. This is also the default position. A custom position can be specified with the parameters x and y. It is possible to change the position after creation with commands like s3sprite.setPosition.
The order defines the rendering order (and optionally also the sorting layer). Images with a lower order/sorting layer are rendered first.
Optionally a color and transparency can be defined with color. The default color is white (r,g,b = 255), the default transparency is opaque (alpha 1).
Example:
Loading and displaying an image1
2
2
cursor = s3sprite.load("interface/cursor.png")
s3sprite.create(cursor, 5, 5)
s3sprite.create(cursor, 5, 5)