Skip to content

Instantly share code, notes, and snippets.

@josefnpat
Last active January 1, 2019 20:03
Show Gist options
  • Save josefnpat/cf923eaa5675c11ed941cf315bdd7041 to your computer and use it in GitHub Desktop.
Save josefnpat/cf923eaa5675c11ed941cf315bdd7041 to your computer and use it in GitHub Desktop.
avoid game in 560 characters
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
n=9y=64s=0p={s={{-6,-6},{-2,0},{-6,6},{6,0}}}a={}q=all
function k(t,f,v)line(t.x+f[1],t.y+f[2],t.x+v[1],t.y+v[2])end
function o(t)f=nil for v in q(t.s)do if f then k(t,l,v)else f=v end l=v end k(t,l,f)end::_::r=rnd
if(btn(2))y-=2
if(btn(3))y+=2
y=max(0,min(127,y))c=color
if#a<n then
w={x=127+r(255),y=r(127)}add(a,w)w.s={{1,1},{1,-1},{-1,-1},{-1,1}}for v in q(w.s)do
v[1]=v[1]*r(8)v[2]=v[2]*r(8)end
end
cls()c(11)
?s
p.x=9 p.y=y
c(8)o(p)c(4)for v in q(a)do
v.x-=1if(v.x<0)del(a,v)s+=1n+=0.2
o(v)if 6>abs(v.x-9)and abs(v.y-y)<6then
stop()end
end
flip()goto _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment