Making a game in PICO-8: Shooting frogs

This is the fourth part of my diary about making my first-ever game, using PICO-8 [official site].

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 8×8 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.

9 Comments

  1. Robert The Rebuilder says:

    I sure hope that there is a reader out there who was deathly afraid to program their own game, but after reading this excellent series, sheds their fears and dives right in – just like Alex did.

    IMHO it’s the best way to get started.

    • Premium User Badge

      MajorLag says:

      These days, it seems to me, programming is not the biggest hurdle to game development anymore. Between Unity, GameMaker, and all the similar tools, one barely needs to learn any programming at all. The biggest hurdle, for my money, is asset creation. It takes forever to make mediocre models, textures, and even sprites when you aren’t an artist.

  2. apa says:

    Alex, I’ve done software development for 16 years (not games but the boring enterprise side) and let me tell you, it’s the same all the time, every time. “Now A works! Wait, why doesn’t B work? Ok now B is fixed but A broke and I still need to do C…”

    • Koozer says:

      “Sigh, at least X, Y & Z still work, they don’t relate to- wait WHAT”

      or

      “Finally, A, B & C work! But A could be more efficient like this…”

    • Phil Culliton says:

      It’s the same in game development, except that everyone takes A, B, and C for granted (every game has those!), and everyone wants D, which is some unspecified thing that exists solely as an idea different from A, B, or C, has about the same probability of living beyond the box as Schrodinger’s Cat, and is only useful or fun inasmuch as it might be in the Neverending Story child version of each individual gamer’s mind wherein it also happens atop a giant fuzzy flying dragon whilst all their dreams come true.

  3. king0zymandias says:

    This is exactly how you start, make mistakes and find solutions, one step at a time, one problem at a time. Every problem, every project no matter how large or complicated can be broken down into easily digestible little chunks. Once you realize that, nothing is impossible anymore. I don’t know if you plan to stick to it, but you have started exactly how you should.

    PS: A suggestion for the game- maybe increase the speed of the plunger so that it moves at a different speed from the characters? Like maybe the projectile moves 2 tiles every turn instead of one.

  4. cvaldivia93 says:

    Frogs, movement, collisions – sounds like you’re dabbling in Newt-onian physics.

  5. Layabout says:

    Thanks for this series so far. I’ve been dabbling off and on with games development for years (about 20) without ever getting anywhere serious and pico-8 looks like my perfect development environment. Its also available in the humble bundle at the moment along with their other voxel fantasy console.

  6. Premium User Badge

    MajorLag says:

    Sounds like you’ve discovered one of the most annoying parts of game development: You have to put in a lot of time just to determine if your concept is even going to be any fun. And from experience, it usually isn’t, often can’t be fixed, and you have to start the design process over.