Play game
The CONCEPT of SPACE's itch.io pageCompressed Bytes used
1023
Source Code (OPTIONAL)
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 _
Link to Commented Source Code (OPTIONAL)
https://gist.github.com/mhungerford/565a66e3a4deb99ad9592b9b81517bb0
Leave a comment
Log in with itch.io to leave a comment.