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 _update() and _draw() functions 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 Edit

function _init()
  -- start player in lower center of screen

See also Edit