Play game
Crusin' Cyber Highway 9's itch.io pageCompressed Bytes used
1024
Source Code (OPTIONAL)
camera(-64,-64)posz=0
::start::
cls()?-posz.." cyber metres",-35,0
?"press โ",-20,6
if(btn(โ))goto real
flip()goto start::real::
sc={{-.25,0,-1},{.25,0,-1},{.75,0,0},{-.75,0,0},{0,.5,0}}
faces={{1,2,3,4},{4,5,3},{1,2,5}}
r=0n=4f=64๐ฑ1=(f+n)/(n-f)๐ฑ2=2*f*n/(n-f)๐จ=16rm=๐จ+1posz=0posx=0rep=72sz=posz-4sx=posx
function gh(x,z)bh=sin((x+z)/(rep/2))+cos(z/rep)
if abs(x)==๐จ then
bh=8elseif abs(x)>=๐จ/1.5then bh=4end
return bh/2end
hj={}
for z=0,๐จ-1do
for x=1,๐จ do
add(hj,{x+z*rm,x+1+z*rm,x+1+(z+1)*rm,x+(z+1)*rm})
end
end
function ic(fz,lz)return lz>=-1and lz<=1and fz>=-1and fz<1end
function df(sq,๐ฑ)
for i=1,#sq do
cp=๐ฑ[sq[i]]np=๐ฑ[sq[(i%(#sq))+1]]
if ic(np[3],cp[3])then
line(np[1]*64,-np[2]*64,cp[1]*64,-cp[2]*64,col)end
end
end
function tm(๐ฑ)
x=๐ฑ[1]-posx
y=๐ฑ[2]-ch
z=๐ฑ[3]-posz
w=-z
x/=w
y/=w
z=z*๐ฑ1+๐ฑ2
z=z/w
return{x,y,z}
end
es={}
function ds(sx,sz,rot,scol)
w={}
for ๐ฑ in all(sc)do
add(w,{๐ฑ[1]+sx,๐ฑ[2]+gh(sx,sz),๐ฑ[3]+sz})
end
sp={}
for ๐ฑ in all(w)do
add(sp,tm(๐ฑ))
end
col=5
fillp(โ)
for i=1,#faces do
df(faces[i],sp)
end
w={}
for ๐ฑ in all(sc)do
y=๐ฑ[2]z=๐ฑ[3]x=๐ฑ[1]xx=cos(rot)*x+y*sin(rot)yy=-sin(rot)*x+cos(rot)*y
add(w,{xx+sx,yy+gh(sx,sz)+.5,z+sz})
end
sp={}for ๐ฑ in all(w)do
add(sp,tm(๐ฑ))end
col=scol
fillp()for i=1,#faces do
df(faces[i],sp)
end
end
::loop::
cls()ch=gh(posx-1,posz)+4h={}l=-๐จ*2l+=posz/2\1*2u=l+๐จ*2+2
for z=l,u,2do
for x=-๐จ,๐จ,2do
add(h,{x,gh(x,z),z})end
end
if(rnd()<0.05)and#es<21then
x=rnd((๐จ-6)*2)-(๐จ-6)add(es,{x,l,max(-0.4,rnd(2)-1)})
end
tp={}for ๐ฑ in all(h)do
add(tp,tm(๐ฑ))end
for i=1,#hj do
col=8fillp()
if(i<๐จ*5)col=2
if(i<๐จ*3)col=1
if(i<๐จ*2)col=1fillp(โ)
df(hj[i],tp)end
for ๐ฑ in all(es)do
๐ฑ[2]+=๐ฑ[3]
ds(๐ฑ[1],๐ฑ[2],0,12)
if(๐ฑ[2]>u)del(es,๐ฑ)
if(((๐ฑ[1]-sx)^2+(๐ฑ[2]-sz)^2)<1or gh(sx,sz)>=2)goto start
end
ds(sx,sz,r,7)posz-=.5sz-=.5๐ณ=0
if(btn(โฌ
๏ธ))๐ณ=.05
if(btn(โก๏ธ))๐ณ=-.05
e=๐ณ-r
r+=e/5posx-=r*8.3sx-=r*10.3?-posz\1,-5,-64,7
flip()goto loop
Leave a comment
Log in with itch.io to leave a comment.
Comments
very nice idea and I love the visuals. I feel that the game could become harder after a while so you would be kept on your toes
Yup, escalating difficulty (fundamentally the speed and frequency cars come at you) is the missing ingredient but I just couldn't crunch the code down far enough to fit it in.
Nice game! The controls and movement of the ship feel very good. It looks like the typical Tron highway with rush hour traffic you find everywhere.
Really enjoyed this! Made it to 1887.5 on the first try. So Tron!
Great job on this! It looks good, but even more impressively the controls and physics are great, too!
If you have anything more you wanted to add, it does seem like there's a bit of room to cram things further, I looked over it a bit and got the byte count down to 993. ;)
I knew it - for someone who regularly writes tweetcarts I am strangely bad at crunching code. I strongly suspect I can take another pass at the ship drawing code and kill what is basically an entire duplicated block.
I'm really happy with the ship feel, the movement speed is directly linked to how much the ship is turned and the turn angle is governed by a proportional error based feedback controller which makes it nice and smooth and gives it the momentum/weight feel.
Anyone wanting a hard mode just needs to turn that r+=e/5 at the end into r+=e/20 for "heavy ship" mode.