cart
function _init() -- once
function _update() -- 60x a second
function _draw() -- after _update
spec
| screen | 256x224 (320x180, 512x448) |
| colours | 16 palettes x 16 |
| sprites | 512 of 16x16 |
| map | 4 layers, 128x128 tiles |
| sound | 8 ch, 64 sfx, 64 patterns |
| code | Lua 5.4, 16,384 tokens |
| cart | 64 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 3 | left right up down | arrows |
| 4 5 | A B | x z |
| 6 7 | X Y | s a |
| 8 9 | L R | q w |
| 10 | start | enter |
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])
| wave | 0 sine 1 tri 2 saw 3 square 4 pulse 5 thin 6 organ 7 noise |
| fx | 0 none 1 slide 2 vibrato 3 drop 4 fade in 5 fade out 6 arp fast 7 arp slow |
| pitch | 0-95, 48 = C4 |
| flags | 1 loop start, 2 loop end, 4 stop |
shell
| new | new cart |
| load <cart> | .r16 .r16.png .lua |
| run / resume | run / go back to it |
| save [name] | name.png = png cart |
| export [name] | standalone game |
| ls / cd / cls | files, folders, clear |
keys
| esc | shell / editors / stop |
| F1 F2 F3 | code, sprite, map |
| ctrl+r | run |
| ctrl+s | save |
| tab | (running) next screen mode |
| ctrl+z / y | undo / redo (code) |
| right click | pick 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.