Difference between revisions of "VisionaireObject Command: getSprite"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "Returns the sprite values of a VisionaireObject field. == Syntax == <syntaxhighlight lang="lua"> getSprite(field) </syntaxhighlight> == Parameters == {| class="ts" |- ! s...") |
(No difference)
|
Latest revision as of 23:58, 11 August 2023
Returns the sprite values of a VisionaireObject field.
Syntax
getSprite(field)
Parameters
| Parameter | Type | Description |
|---|---|---|
| field | integer | The field which specifies a sprite. The field type must be "t_sprite".
Specify the field constant name (V + object table name in singular + field name) or the field id, see the example. |
Return values
| Type/Structure | Description | |
|---|---|---|
| table | path (str) | relative path to the image file stored in the field |
| position (t_point) | sprite offset stored in the field, in case sprite is used in an animation | |
| transparency (int) | ||
| transpcolor (int) | transparent color | |
| pause (int) | pause value of the rectangle stored in the field (in milliseconds), in case the sprite is used in an animation | |
Examples
Example 1: Get the background sprite of an interface.
-- Specify the field constant name or the field id
local inv_bg = getObject("Interfaces[inventory]"):getSprite(VInterfaceSprite)
local inv_bg = getObject("Interfaces[inventory]"):getSprite(238)
-- The shorthand notation offers a more convenient way to achieve the same
local inv_bg = Interfaces["inventory"].Sprite