An entry for TweetTweetJam - a weeklong gamejam where everyone makes a game in 560 bytes or less.
Arrow keys to move, X to reset if you die. Your score is based on your forward distance.
This is super cool! Especially since it takes up less space than, to quote the now sadly defunct Nintendo Gamer, "a Word file listing decent episodes of Pan-Am."
I know this is from a game jam, but would it be possible to modify this so that cars can go in the other direction and there's walls, like the original Frogger? That would up the challenge significantly.
Thanks!
@PicoLate: At one point, I had each lane going in opposite directions, but eventually I removed that to get it down to the size limit. I was either cutting that feature or removing left/right movement from the player, and I decided that the player's controls were more important!
There's definitely room for more features as long as it doesn't need to keep the 560 limit - the real code is super compacted so it's very hard to read, but here's a "cleaned up" version with comments, which runs the same game but would be much easier to modify.
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
|
Good job with the 3d effect and the code limits. Maybe a full version sometime would be neat. My best: 93
[Please log in to post a comment]




