Code: Select all
_=function(a,b,r)a,b=a:match("([^:]*):(.*)")r='return 'return loadstring(r.."function("..a..")"..b:gsub('&',r).." end")()end;l,u,s,c,M,m,T,W,H,E,F,G=love,unpack,math.sin,math.cos,math.max,math.min,table,400,300,{},{},{}T,R,K,g,I,J=T.insert,T.remove,l.keyboard.isDown,l.graphics,{[11]=F,[4]=G},{[18]=11,[11]=4}v=_"D,i,r:T(D,c(i)*r)T(D,s(i)*r)"for e=1,6 do v(E,e,21)v(F,e,13)v(G,e,4)end;k=_"D,v,j,X,Y,r:&{X,Y,r,c(r)*v,s(r)*v,0,j,D}"r=_"a:if a==0 then A,B,P={},{},k({10,0,-5,5,-5,-5},0,4,W,H,0)for i=1,6 do A[i]=k(E,i*7,18,W+c(i)*160,H+s(i)*120,i) end end"o=_"D,O,p,q:p,q=D[1]-O[1],D[2]-O[2];&M(0,m(1,p*p+q*q-D[7]*D[7]))"z=_"D,X,Y,r,x,y:D[1],D[2],D[6]=(X+d*x+9)%818-9,(Y+d*y+9)%618-9,D[6]+d"q=_"D:g.translate(u(D));g.rotate(D[3]);g.polygon('line',u(D[8]));g.reset()"l.draw=_":q(P)for i=1,#A do q(A[i]) end;for i=1,#B do q(B[i]) end"l.keypressed=_"d:if d=='p' then T(B,k(G,149,3,u(P)))end"C=_"n,c:&M(-99,m(99,P[n]+c(P[3])*(K'w'and 1 or 0)))"r(0)f=_"a,f:for i=#a,1,-1 do f(a[i]) end"function l.update(h)d=h;P[3],P[4],P[5]=P[3]+d*(K'a'and-3 or(K'd'and 3 or 0)),C(4,c),C(5,s)z(P,u(P))f(B,_'b:z(b,u(b))')for e=#B,1,-1 do b,h=R(B,e),2;for i=#A,1,-1 do a=R(A,i)t=J[a[7]]or 0;h=m(h,o(a,b)*2)for l=1,(1-o(a,b))*m(4,t)do T(A,k(I[t],l*9,t,a[1],a[2],l*2))end;T(o(a,b)<1 and{}or A,a)end;T(b[6]>h and{}or B,b)end;f(A,_'a:z(a,u(a))r(o(a,P))')r(#A)end
Yes: external assets (images, sounds, fonts) are not allowed
Yes: asteroids, the player ship and bullets should wrap around the screen
Yes: the gameplay must reset when you destroy all the asteroids or when you die
Yes: bullets should have a limited range/lifetime
Yes: the ship speed should not exceed that of the bullets
Yes: delta
Yes: difficulty (asteroids should break apart as you progress) -- This is the one I think wrecked my budget the most.
Maybe: different "models" for the asteroids, does rotating them count?
No: explosion effects
No: score
No: sound effects
Failed: the entire game must be contained in 1024 bytes or less
I'm going to try again with a different technique.