Update: Difference between revisions
Jump to navigation
Jump to search
imported>Dddaaannn (New reference article: _update()) |
imported>Dddaaannn No edit summary |
||
| Line 17: | Line 17: | ||
* [[Init|_init]] | * [[Init|_init]] | ||
* [[Stat|stat]] | * [[Stat|stat]] | ||
[[Category:Reference]] | |||
Revision as of 02:03, 5 June 2016
The _update() function is the first part of the game loop.
If a cartridge's source code includes both an _update() function and a _draw() function, then Pico-8 will attempt to call these functions once for each animation frame, at a rate of 30 frames per second.
You define this function in your game's source code. It takes no arguments.
The intended purpose of _update() is to test for user inputs (button presses), perform all of the calculations to advance the state of the game, and update the game's data structures with the results. Typically, this function does not update the display, though it may initiate sound effects (sfx()) and music (music()).
See the entry on the game loop.