SpriteOverride (class)

From PGE Wiki
Jump to: navigation, 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. In addition you can patch the hardcoded images with the graphics group "hardcoded".
* is the id of the object. With the "hardcoded" graphis 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.