RICO-16 cheatsheet v0.1 · print it, it fits on one page

cart

function _init()   -- once
function _update() -- 60x a second
function _draw()   -- after _update

spec

screen256x224 (320x180, 512x448)
colours16 palettes x 16
sprites512 of 16x16
map4 layers, 128x128 tiles
sound8 ch, 64 sfx, 64 patterns
codeLua 5.4, 16,384 tokens
cart64 KB

graphics

cls([col])
pset(x,y,[col])   pget(x,y)
line(x0,y0,x1,y1,[col])
rect(x0,y0,x1,y1,[col])
rectfill(x0,y0,x1,y1,[col])
circ(x,y,r,[col])
circfill(x,y,r,[col])
print(s,[x],[y],[col]) -> x
camera([x],[y])

sprites

spr(n,x,y,[fx],[fy])
sprx(n,cx,cy,[angle],[sx],[sy])
  angle in turns, 0.25 = 90deg
sset(x,y,[col])   sget(x,y)
sprpal(n,[p]) -> p

palettes

pal(c0,c1)   pal()
palt(col,t)  palt()
palset(p,col,0xrrggbb)

shapes + text use palette 0, sprites their own. colour 0 is transparent.

map

map(layer,[x],[y])
mget(layer,cx,cy)
mset(layer,cx,cy,n)
mapsize(layer,[w],[h]) -> w,h
mode7(layer,x,y,[angle],
      [height],[horizon])
mode7line(layer,y,wx,wy,dx,dy)

input

btn(b,[player])
btnp(b,[player])
0 1 2 3left right up downarrows
4 5A Bx z
6 7X Ys a
8 9L Rq w
10startenter

sound

sfx(n,[ch])      sfx(-1)
music([p])       music(-1)
sfxset(n,i,pitch,[wave],[vol],[fx])
sfxspeed(n,speed,[ls],[le])
pattern(p,flags,s0,[s1],[s2],[s3])
wave0 sine 1 tri 2 saw 3 square 4 pulse 5 thin 6 organ 7 noise
fx0 none 1 slide 2 vibrato 3 drop 4 fade in 5 fade out 6 arp fast 7 arp slow
pitch0-95, 48 = C4
flags1 loop start, 2 loop end, 4 stop

shell

newnew cart
load <cart>.r16 .r16.png .lua
run / resumerun / go back to it
save [name]name.png = png cart
export [name]standalone game
ls / cd / clsfiles, folders, clear

keys

escshell / editors / stop
F1 F2 F3code, sprite, map
ctrl+rrun
ctrl+ssave
tab(running) next screen mode
ctrl+z / yundo / redo (code)
right clickpick colour / tile

lua

table string math coroutine utf8
math.random  math.floor  //

no io, os or require. end, local, commas and closing brackets cost 0 tokens.