SpriteOverride (class)

From Moondust Wiki
Revision as of 04:30, 4 April 2016 by Pyro (talk | contribs) (Fixed some code that will cause errors. Not sure why it was like this in the first place...)
Jump to navigation Jump to search

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.
* is the id of the object.


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.