1K Space Battle #Pico1k
Your space ship is under attack! A game in 1023 Compressed Bytes of code for PICO-1K Jam 2022 #Pico1k
Code:
h=0t={16,16,16,2,8,2,4,8,0,9,0,9}m={}for i=1,#t,2do for k=0,1,1/6do b=t[i+1]add(m,{x=t[i],y=cos(k)*b,z=sin(k)*b})end end ::r::x=64y=64u=0v=0z=3s=0g=6::s::t=0?"\asfccggg.gfedc4cg3gg" p={}for i=1,z do b=1.2+rnd(1.6)e=1.2+rnd(1.6)add(p,{i=0,l=2,b=b/512,c=rnd()<.5and.85or.35+rnd(.1)-b,e=e/512,f=rnd()<.5and.85or.35+rnd(.1)-e,t=t+rnd(512),j=rnd(512)})end ::_::cls(1)t+=1 ?"♥"..g,7 ?s ?h for w in all(p)do if w.i<1then o=t-w.t a=384-o/2 e=a*sin(w.b*o+w.c)f=a*sin(w.e*o+w.f)o=584-o a=1b=1c=1if(w.x!=nil)a=e-w.x b=f-w.y c=o-w.z w.x=e w.y=f w.z=o d=(a*a+b*b+c*c)^.5a3=a/d a6=b/d a9=c/d a=-a6 b=a3 d=(a*a+b*b)^.5a1=a/d a4=b/d a2=a4*a9 a5=-a1*a9 a8=a1*a6-a4*a3 n={}for i=1,#m do q=m[i]n[i]={x=a1*q.x+a2*q.y+a3*q.z,y=a4*q.x+a5*q.y+a6*q.z,z=a8*q.y+a9*q.z}end j=64/w.z for i=1,#n-7do q=n[i]r=n[i+1]o=n[i+7] k=1a=64+j*(w.x+k*q.x)b=64+j*(w.y+k*q.y) line(64+j*(w.x+k*r.x),64+j*(w.y+k*r.y),a,b) line(64+j*(w.x+k*o.x),64+j*(w.y+k*o.y)) k=-1a=64+j*(w.x+k*q.x)b=64+j*(w.y+k*q.y) line(64+j*(w.x+k*r.x),64+j*(w.y+k*r.y),a,b) line(64+j*(w.x+k*o.x),64+j*(w.y+k*o.y)) end w.w=j*16w.u=64+j*w.x w.v=64+j*w.y w.j-=1if(w.j<1)add(p,{i=1,l=1,u=w.u,v=w.v,w=4})w.j=512 if(w.z<24)w.l=0 elseif w.i<2then w.w+=.5 for i=0,5do a=i/6+t/99c=w.u+w.w*cos(a)d=w.v+w.w*sin(a) for j=0,5do b=j/6+t/99e=w.w*cos(b)/3f=w.w*sin(b)/3 line(c-e,d-f,c+e,d+f,11+t%6)end end if(w.w>32)w.l=0g-=1?"\as3ec" elseif w.i<3then w.w+=2 for i=0,7do a=i/8c=w.u+w.w*cos(a)d=w.v+w.w*sin(a) pset(c,d,11+t%6)end if(w.w>32)w.l=0 end if(w.l<1or w.i>2)del(p,w) end b=btn()x=mid(x+2*(b\2%2-b%2),128)y=mid(y+2*(b\8%2-b\4%2),128) u-=1if btn(4)and u<0then ?"\as2i4cge" u=10v=127-v for w in all(p)do if(w.i<2and max(abs(w.u-x),abs(w.v-y))<w.w)w.l-=1s+=1add(p,{i=2+w.i,l=1,u=w.u,v=w.v,w=4})break end end ?"><",x-3,y-2,10 if(u>6)line(0,v,x,y)line(127,v) if(#p<1)z+=1goto s if(g<1)h=max(s,h)goto r flip()goto _
Leave a comment
Log in with itch.io to leave a comment.