Dev - Lua Libraries

Lua Command: s3sprite.setColor

Parameters

Return Values

void

- no return values

Signature

s3sprite.setColor(int spriteID, color color, bool recursive = false)

Description

Changes the color and transparency of the sprite with the given spriteID.

You can also change the color of all children of the sprite by setting recursive to true. By default no children will be changed.


Example:

Load and image, display it and change the color to a semi-transparent red
1
2
3
cursor = s3sprite.load("interface/cursor.png")
s3sprite.create(cursor, 5, 5)
s3sprite.setColor(cursor, {255, 0, 0, 0.5})

Note:

See data types: color to learn how colors are specified!