Modules
A module is a collection of code that can be accessed by a program in SuperCode. SuperCode has modules for behaviours related to movement, particles, players, and many other things! To see the full set of modules available in SuperCode, check the online reference docs.
Modules typically contain functions that are designed to perform tasks or actions related to a specific theme or domain. For example, the “Task” module contains two functions:
wait()
, which pauses execution for the specified number of secondsyield()
, which pauses execution for one “frame” (which is approximately 33 milliseconds)
You can call any function from a module by writing the name of the module (in PascalCase), followed by a .
, followed by the name of the function from that module that you would like to call. For example, the following program uses the open()
function from the Door module and the wait()
function from the Task module to control a door to open and then close after 2 seconds.
function onStart()
Door.open()
Task.wait(2)
Door.close()
end