PlayerGfx.lua

Download latest version Download example level

Note: This library is no longer required due to Lunalua 0.7.3 and up can replaces PNG files at runtime by using Graphics.sprites.(playername)[powerup].img function.

playerGfx is a library for swapping or overlaying sets of player graphics at runtime.

Installation
Drop the playerGfx.lua file in the LuaScriptsLib folder.

How to use
Overlay/replacement images should be formatted like regular SMBX player graphics, except they must be PNG files with transparent backgrounds and they should ideally use the naming convention "[prefix]_[number]" as opposed to SMBX's default "[prefix]-number". They should be placed in the episode or level folder.

Once you have your images in place, load in the API and use 'playerGfx.arrayFromPrefix' to generate a table of your images' filenames. Use that table in PlayerGfxSet.createEx to generate a PlayerGraphicsSet instance, and call playerGfx.assignSet to assign a PlayerGraphicsSet to a given character.

Player graphic sets are only used when playerGfx.isOn == true; use playerGfx.enable, playerGfx.disable and playerGfx.toggle to activate and deactivate the system.