The CONCEPT of SPACE
About
The Concept of Space
This years entry into the #Pico1k jam.
Uses 1023 compressed bytes of code, no external assets (no images or sound files).
Previous years entry was pico-xkcd.
Rules- Launch balls into the empty space. Balls will expand to fill up all available space.
- Hit previous balls 3 times to burst them and earn a point. Balls indicate remaining hits (red=3, orange=2, green=1).
- You lose by having a launched ball roll over the dashed "Danger Line" at the bottom.
- physics based collisions
- simple particle effects
- P8SCII usage for title, score and sound-effects.
- algorithmic filling of available space (accounting for other objects and bounds)
- high-score saving
Liquidream's speed-pool-1k demo from last years 1k jam for its simplification of PC101's Elastic 2D ball physics.
This game is a remake of a homebrew game from a GamePark handheld I remember playing 20 years ago.
Commented Source CodeAvailable here: gist
Compressed Code == 1023 bytes (of 1024 limit for Pico1k Jam)
cartdata("tcos") l={} tp=2 tb=92 sa=15 u=1 g=-1 s=0 h=dget(0) p={} _set_fps(60) ::_:: cls() line(2,tb,2,2,7) line(126,2) line(126,tb) fillp(░)line(2,tb)fillp() ss="\^pscore "..s.." high "..h xo=min(2,128-?ss,0,-128) ?ss,xo,116 mv=0 if(#l > 0)do b=l[#l] x=b.x y=b.y b.v*=.97 b.b*=.97 x+=b.v y+=b.b mv=abs(b.v)+abs(b.b) if(mv < 0.02)do mv=0 b.v=0 b.b=0 end e=min(min(min(min(96,x-tp-2),126-x-1),y-tp-2),tb-y-1) for k,t in pairs(l)do circ(t.x,t.y,t.r,({11,9,8})[t.c]) if(k!=#l)then a=x-t.x z=y-t.y d=sqrt(a*a+z*z) e=min(e,d-t.r-1) if(d<=b.r+t.r)then t.c-=1 o=(d-b.r-t.r) x-=o*(a/d) y-=o*(z/d) n=(t.x-b.x)/d r=(t.y-b.y)/d v=b.v*-r+b.b*n k=t.v*n+t.b*r b.v=(-r*v+n*k)*1.15 b.b=(n*v+r*k)*1.15 for i=0,20 do add(p,{x=t.x-n*(d-b.r),y=t.y-r*(d-b.r),a=rnd(100)/100.0,s=rnd(3)/3,c=max(t.c,1),n=80}) end ?"\as0c",0,0 end end end if(mv==0 and e>b.r)b.r+=1 foreach(l,function(t) if(t.c==0)del(l,t)s+=1 end) if(x+b.r>126 or x-b.r<2+1)b.v*=-1.1 if(y-b.r<tp)b.b*=-1.1 if(b.b > 0 and y+b.r>tb)dset(0,h)g=1 b.x=x b.y=y end foreach(p,function(o) o.x+=rnd(1)*sin(o.a)*o.s o.y+=rnd(1)*cos(o.a)*o.s pset(o.x,o.y,({11,9,8})[o.c]) o.n-=1 if(o.n<=0)del(p,o) end) h=max(h,s) rt=flr(t()%3)*4-4 if(g==1)?"\^t\^wgame over",30+rt,24+rt,12 if(g!=0)?"\^t\#7the concept of space",25,44,0 if(g!=0)?"press x to start",34,64,12 co=cos(sa/360) si=sin(sa/360) line(64,112,64-16*co,112+16*si,7) if mv <=0 and g==0 then if(sa<=15)u=1 if(sa>=165)u=-1 sa+=u end if btnp(5)then if g==0 and mv <=0 then b=add(l,{x=64,y=112,r=4,c=3,a=0,v=-5.9*co,b=5.9*si}) elseif g!=0 then l={}g=0 s=0 end end flip()goto _