This entire cart is 243 characters (plus six sprites). The code is just:
k,f,q,b=64,0,sqrt,btn x,y=k,k::a::cls(12)for j=3,k do s=j/4 sspr(q(q(s))*16-f%8/4,1,k+k,1,k-j*32,k+j,k*4*s,1)end r=b(1)p=22 if(r)x+=2,p=16 if(b(0))x-=2,p=16 if(b(2))y+=1,p=k if(b(3))y-=1,p=70 spr(28,x+8,99,4,2)spr(p,x,y,6,3,r)flip()f+=1 goto a
It was a successful attempt to code the basics of a game in two tweets. There's actually enough room to clamp x and y to the screen. I hope someone will use this as a starter to make a real game.
The bottom part is the waterfall demo and some generic particle emitter code.
You can save a few more cycles if you hardcode the gravity constant. Otherwise I believe that this is close to optimal.
More information at my github
I wrote Brick Breaker as a full-featured, polished PICO-8 sample program. It was an opportunity for me to learn the PICO-8 Lua variant and now stands as a good example program for other programmers new to PICO-8.
It demonstrates (commented) use of:
- create & destroy objects
- local vars
- multiple levels
- sprite animation
- map usage
- title screen & game over
- sound effects
- sprite packing
- basic physics
as well as some techniques for reducing token count, a limited resource on PICO-8.