Wohlsoft.ru Wiki Page
Call the API with:
Code: Select all
local bgofix = API.load
To change the render order, just call this function in onStart:
Code: Select all
bgofix.setPriority(id, priority)
priority is the LunaLua render priority, NOT the SMBX sort priority. You can find more information here.
To change a BGO's animation, call:
Code: Select all
bgofix.setAnimation(id, numFrames, frameSpeed)
numFrames = the number of frames
frameSpeed = the frame speed in SMBX ticks per frame. If not defined, it is set to 8 by default.
To set an animation, you must create an image of all the frames, in the same style as all the other animated images in SMBX, with the naming convention, "bgo-anim-*.png," where '*' is the ID.
For the regular "background-*" custom image, just make an image of the first frame. This is so it won't look screwy in the PGE editor.
This API will also serve as a temporary fix for the bug with lunaTester that makes BGOs with smaller custom images than the originals to look screwy.
Download: https://www.dropbox.com/s/v3aaet4ij4wd3 ... x.zip?dl=1
To install, just drop the contents of the zip into your luaScriptsLib folder.
Notes. Please read before you complain about the API not working:
- The custom BGO images must be in .PNG format for this API to work, because LunaLua's drawImage function doesn't support drawing of masked GIFs.
- If you make an animated background of a custom size, it won't be displayed correctly unless you use the setAnimation function.
- This API uses LunaLua render priorities when drawing BGOs. The custom BGOs should render in about the same order as they do normally, but slight changes may occur. If this happens, just use setPriority to fix it.
- If you try to use this with the legacy SMBX editor, you're gonna have a bad time, because they will still be the original size. Use Wohl's editor.