Init
Jump to navigation
Jump to search
The _init()
function is called by PICO-8 to initialize a cartridge.
You define this function in your game's source code. It takes no arguments.
PICO-8 calls this function after evaluating all of the source code. In typical usage, a cartridge's source code includes definitions for functions and variables, an _init()
function, and then an _update()
function and _draw()
function for the game loop. PICO-8 calls _init()
once before starting the game loop.
If any code outside of functions has side effects, these effects occur before _init()
is called. (This is trivial if the code consists only of function and global variable definitions.)
Examples
function _init()
-- start player in lower center of screen
player_x=64
player_y=100
end