PICO-8 Wiki
Advertisement
flip( )
Copies the graphics buffer to the screen, then synchronizes to the next frame at 30 frames per second.

Carts that use the built-in game loop functions _update() and _draw() do not need to call flip(). You can use flip() if you want to implement your own game loop and still synchronize to the 30 frames per second draw timer.

Note: If the _draw() game loop is not used by the program, Pico-8 will copy the graphics buffer to the screen 30 times per second automatically even if flip() is not called as often. flip() waits until the next frame has been copied, synchronizing program execution to the frame timer.

Examples

for x=4,124 do
  cls()
  circfill(x, x, 4, 8)
  flip()
end

This example animates a circle moving diagonally across the screen, one pixel per frame for 120 frames (four seconds).

If you remove the call to flip(), this clears the graphics buffer and draws the circle 120 times, but the buffer is only copied to the screen when the program exits.

See also

Advertisement