Since No Frog Left Behind now has a frog and a player moving on lily pads, it’s finally time to implement the game’s core mechanic, the ability to push the frog across the map with a bullet. Because this is a game about pushing frogs into boxes.
This feels like it’ll be a big job, pushing my collision system to potentially logic-busting extremes. And on top of this, I’m starting to get other fears. All this time I haven’t really thought much about the actual game design. I have no real idea whether pushing frogs into boxes is going to be fun. Now the frog moves entirely randomly and the game is turn-based, so it’s not even the design I’d originally conceived.
I’m starting to see that I’ve not been designing so much as simply building, investing time and effort into something I don’t really know the nature of. And all the time it’s being pushed, in fits and starts, in unforeseen directions because of the paucity of my skills and my fears of failing. And at the rate I’m working, I’ll only just have gotten it playable before my time runs out. Huh.
So I decide to change the sprite for the player from a weird little guy to an eyeball.
There is a reason for this! I want the bullet to appear from the direction the player is facing, and I need a way of representing this, plus my drawing skills are such that I can just about stretch to two circles. I’m not sure how this fits into the game’s fiction, but I’m aware of time, so I get straight to figuring out how to grab the direction and flip the sprite or switch to a different one, dependent on which way it’s facing, and voila.
OK, so bullets. Back to drawing, I create a plunger, because it’s a non-lethal sort of a projectile. In the code, I place the plunger on the tile the player is facing. The game then uses the information about direction to correctly add or subtract eight pixels from the plunger’s position each turn. I hook in controls so it fires when you press Z, and - finally - I stop it from moving when it gets to the edge of the level. BAM.
OK, so the plungers won’t go away when you fire another one. Also only one plunger can move at once. I know in general terms what’s causing this: it’s to do with how the code I used to create bullets stores their information in a table. It seems I can only have one bullet. I don’t know why they aren’t disappearing when you fire again or why they’re still visible when they hit the outer limit of the level.
This problem is going into territory that feels beyond me, at least in the time I have remaining. I don’t really know how to look inside an array, or change it, or add new things to it in ways other than how the code I copied out of the Collide demo does it.
So, OK, how about only getting to shoot one plunger at a time? So if you press the shoot button when one’s already in flight, it gets insta-recalled and fired again. And when it hits the edge of the level, I swap its sprite for a transparent one and move it to the top corner of the screen so it’s out of the way. It’s a total fudge, and it again changes the shape of the game’s design. But it works and kind of makes sense.
The next job, to make the plunger hit the frog and push it back, works pretty smoothly, using my trusty old flag lookup system to stop the frog getting pushed off the lily pads. So smoothly, in fact, that I give the frog a much needed make-over, so instead of a splat of green, it now has this rather supercilious sideways look that makes me feel less guilty for basing a game on hitting it. I also add a sound effect and swap its sprite to one relating shock and possible confusion for classic rewarding gamefeel.
Finally, having failed to draw a convincing box in 8x8 pixels, I decide to lean on the eyeball’s design and create a flying saucer sprite, which is what you’ll be pushing the frog into to win the level. Because, being an eyeball, you’re an alien, right? So it’s a sort of frog abduction simulator?
OK! I put a turn counter in so there’s a sort of score, and we have a gameloop! Other than polish, I just need to design some levels, and it’s done! But there’s definitely something still bothering me about No Frog Left Behind. It’s been a productive session, though, so I think I’ll let you try it out right here.
Tomorrow: levels! And a complete game!
Here’s the full series, which we’ll be publishing daily over the week of Christmas. Also, just to note that PICO-8 is available right now in a Humble GameDev Software Bundle, in case you're interested in trying it out.