Here's Froggy Road, de-obfuscated! I tried to make the variable names more clear and removed all the line-break-saving measures, but I didn't change any of the logic, so there are still some spots where it does a weird thing to avoid an if statement or whatever (for example, every road-lane draws a frog, but they're all hidden offscreen except for the lane which actually-currently-contains the player).
(edit - like with tobiasvl, my linebreaks get stripped here - here's a version on pastebin which keeps them intact)
frogX=0
frogY=0
died=0
camX=frogX
camY=frogY
::_::
flip()
cls(1)
// weird arrow key input
z=btnp()
// add +/- 5 to x for right/left arrows
frogX+=(flr(z/2)%2-z%2)*5
// add +/- 1 to y for up/down arrows
frogY-=flr(z/8)%2-flr(z/4)%2
// camera eases toward frog position
camX+=(frogX-camX)/3
camY+=(frogY-camY)/3
// draw road lanes
for laneY=frogY+25,frogY-2,-1 do
// each lane has its own randomized properties
srand(laneY)
// car animation properties
cycleOffset=rnd()
carSpeed=8+rnd(16)
// perspective distortion strength
// (persp=0 means "infinitely far away")
persp=(laneY-camY+2.3)/12
// draw the road
// (but draw it offscreen if persp<0)
rectfill(-1,64+9/persp,sgn(persp)*127,127,6-laneY%2)
// draw a frog in every lane...
// but offset it off the screen if the
// frog isn't actually in this lane
print("🐱",61+(frogX-camX)/persp+(laneY-frogY)*99,62+7.5/persp,3)
// each lane has a different # of cars
// (early/negative lanes have no cars)
for i=1,sgn(laneY-2)*rnd(8) do
// a car has two halves, parallel to the lane
// (near-half and far-half)
for k=0,1 do
// each car has five sub-circles for the body
for j=-2,2 do
// x-position of this sub-circle
worldX=(i*carSpeed*4+j+t()*carSpeed+cycleOffset-camX)%198-99
// collision detection for the frog
if laneY==frogY and abs(worldX-frogX+camX)<2 then
died=1
end
// far-half of car uses a different persp value
persp2=persp-k/60
// get screen position of this sub-circle
screenX=worldX/persp2+64
screenY=5/persp2+64
// draw this sub-circle
circfill(screenX,screenY,2/persp2,laneY%5)
// draw a wheel, but only if j equals +/- 2
circfill(screenX,screenY+2/persp2,(abs(j)-1)/persp2,0)
end
end
end
end
// self-explanatory death check
if (died>0) then
goto dead
end
// if you're not dead, continue the game loop
goto _
::dead::
// you done goofed
// random red/orange noise
pset(rnd(128),rnd(128),8+rnd(2))
// death UI
print("❎ reset",46,62,7)
// your score is your distance, literally
print("score: "..frogY,3,3)
// restart command
if btn(5) then
run()
end
// haven't reset yet. resume death
goto dead
And then just for the sake of easy comparison, here's the original code:
x=0y=0l=0q=x r=y f=rnd g=flr h=circfill::_::flip()cls(1)z=btnp()x+=(g(z/2)%2-z%2)*5y-=g(z/8)%2-g(z/4)%2 q+=(x-q)/3r+=(y-r)/3 for z=y+25,y-2,-1 do srand(z)o=f()m=8+f(16)p=(z-r+2.3)/12rectfill(-1,64+9/p,sgn(p)*127,127,6-z%2) ?"🐱",61+(x-q)/p+(z-y)*99,62+7.5/p,3 for i=1,sgn(z-2)*f(8)do for k=0,1 do for j=-2,2 do u=(i*m*4+j+t()*m+o-q)%198-99 if(z==y and abs(u-x+q)<2)l=1 v=p-k/60n=u/v+64w=5/v+64h(n,w,2/v,z%5)h(n,w+2/v,(abs(j)-1)/v,0)end end end end if(l>0)goto d goto _::d::pset(f(128),f(128),8+f(2)) ?"❎ reset",46,62,7 ?"score: "..y,3,3 if(btn(5))run() goto d