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

Community content is available under CC-BY-SA unless otherwise noted.