SpriteOverride (class)
Jump to navigation
Jump to search
| This is the archived page of the old LunaLua documentation The rest of LunaLua related articles in this wiki contain a lot of outdated documentation preserved for historical purposes and may be used with legacy versions of the LunaLua.
Please visit the SMBX2 Documentation Page to access the latest documentation for the LunaLua scripting system of the SMBX2 Project. Adding LunaLua contents into this Wiki is not advised. |
This class represents an image resources bounded to a specific sprite. This is a "virtual" class which is created for every SMBX object (Blocks, BGOs, NPCs, ...).
You can access this class with
Graphics.sprites.####[*]
#### represents the graphics group. The different graphics groups are named after the folders in the graphics folder. In addition you can patch the hardcoded images with the graphics group "hardcoded".
* is the id of the object. With the "hardcoded" graphics group, the id is a string. i.e. "33-2"
Example:
Graphics.sprites.block[1].img = myNewImageResource
This example would swap the image resource of the block with the id 1 with myNewImageResource.
To reset it back to default you can do:
Graphics.sprites.block[1].img = nil
Further fields and functions are listed here:
| SpriteOverride class | |||
|---|---|---|---|
| Type | Function/Field | Return values/Value type | Description |
| Field | SpriteOverride.img | LuaResourceImage or SMBXMaskedImage | The current image resource bounded to the object. |