Multipoints.lua

Download Latest Version

Download v1.0 (for LunaLua v0.5 or below)

Multipoints is a library that enhances SMBX midpoints. It allows for multiple midpoints to be placed in a level, and for the player to spawn at a different location to the midpoint itself. It can also expand midpoints in other ways, though these are more advanced.

Installation
Place the file multipoints.lua in the LuaScriptsLib folder.

How to use
1. Place a single SMBX midpoint on the ground in a location separate from the rest of the level. This can be in its own section, or in any point unreachable from playing the level. It is recommended to re-sprite the midpoint so that it is invisible.

2. Re-sprite the Axe NPC as a midpoint. Alternatively, make the Axe NPC invisible, and use a background object re-sprited as a midpoint. Either way, make sure this object disappears when the player makes contact with the checkpoint.

4. Make the checkpoint Axe call a SMBX event on Death. This event does not need to do anything in SMBX, but make a note of the name. Here, it will be referred to as "GetCheckpoint", but any name will work.

5. Make a layer that hides the Multipoint checkpoint and its hitbox. This will be used when we spawn having already collected the checkpoint. Here, it will be referred to as "HideCheckpointLayer", but any name will work.

6. Jump into lunadll.lua, and import Multipoints as an API.

7. Use the function "addCheckpoint" to create a new functioning checkpoint. You must specify the name of the "GetCheckpoint" event, the section containing the Multipoint checkpoint, the spawn location, and the name of the "HideCheckpointLayer" event. You can optionally also specify a list of Lua functions to call when spawning to that checkpoint (this is particularly useful if your Lua program changes state as you progress through the level).

8. You should now have a working checkpoint! You can repeat steps 2-7 as many times as you like to create multiple checkpoints!

Example
After first creating an event called "GetCheckpoint", there is an Axe, re-sprited to look like a midpoint, that will spawn the player at (-150000,-150000), and an event called "HideCheckpointLayer" that removed the midpoint and its hitbox:

Values
These are variables you can access

External Use Functions
These are functions you will need to use the library

Internal Use Functions
These are functions that the library uses to function, but are not necessary for the user