PICO-8 Cheatsheet

Commandline

HELP
SAVE GAME.P8
LOAD GAME.P8
RUN
SPLORE

Variables & Types

A=nil
X=23
local S="TEXT"
T={name:"Joe", age:"32"}

Operators

+ - * / ^ %
< > <= >= ~= ==
#list  "A".."B"
and or not

Functions

FUNCTION ADD(a,b)
 RETURN A+B
END

If-Statement

IF (X  < 33) THEN
 PRINT("HALLO")
else
 print("hey")
END

Loops

--UP
FOR I = 1,10 DO
 PRINT(I)
END

--DOWN
FOR A=10,0,-2 DO
 PRINT(A)
END

--ARRAY
FOR S IN ALL(SHIPS) DO
 PRINT(S.NAME)
END

--Table
FOR K,V IN PAIRS(M) DO
 PRINT("K:"..K..",V:"..V)
END

Tables

t={a="x",b=1}
add(t, v)
del(t, v)
t={1,2,3,4}
print(t[1]) --1-based!! 

Special callbacks

_init() _update() _draw()

Sprites

spr(n, x, y, [w, h],
  [flip_x], [flip_y])
sspr(sx, sy, sw, sh,
  dx, dy, [dw, dh],
  [flip_x], [flip_y])

Colors

Pixel

pset(x, y, [c])
pget(x,y)

Shapes

rect(x0,y0,x1,y1, [col])
rectfill(x0,y0,x1,y1,[c])
circ(x, y, r, [c])
circfill(x, y, r, [c])
line(x0, y0, x1, y1, [c])

Screen

cls()
camera([x, y])
clip([x, y, w, h])

Map

mget(x, y)
mset(x, y, v)
map(map_x, map_y,
  screen_x, screen_y,
  width, height, [layer])

Controls

Player 1:
  ⬅︎⬆︎⬇︎➡︎ Y,X/C,V/N,M
Player 2:
  ASDF, LSHIFT, A

btn([i, [p]])
btnp([i, [p]]) 

Sound

sfx(n, [chan, offset])
music([n, [fade, mask]])

Tracker

0 none
1 slide
2 vibrato
3 drop (drum)
4 fade in
5 fade out
6 fast arpeggio
7 slow arpeggio

Math

abs(x),atan2(dx, dy),
cos(x),sin(x),
flr(x),max(x,y),min(x,y),
rnd(x),sgn(x),sqrt(x)

Shortcuts

Common:
 Save: STR+S
 Change Mode: ESC
 Restart cart: STR+R
Editor
 Undo:STR+Z
 Redo:STR+Y
 Search:STR+F
 Search-Next:STR+G
 Next Function:Alt+⬆︎⬇︎
Pico-8 Cheatsheet. Version 2.1(en). Collected by @ztiromoritz. Font: Joseph White. TTF by RhythmLynx. Inspired by @neko250/pico-8 api and @obone/picozine-3.
German Version
French Version
PDF (DE)
PDF (EN)
PDF (FR)