The Mezunian

Die Positivität ist das Opium des Volkes, aber der Spott ist das Opium der Verrückten

Let’s Code a Crappy 2D Platformer Like Millions o’ Other People on the Internet & Lose Interest & Give Up Only a Few Months In, Part II

Accomplished so much in the last few days:

  • Fully-working camera that automatically adjusts to player position (if she goes past its inner boundaries) & map boundaries & can be moved independently with certain buttons.

  • Block & Map system with tileset. After the slight tedium o’ creating the tileset, the need to create a hundred sprites was replaced by the simple need to paste in an array o’ numbers spewed out by a map made in Tiled. The player’s collision code was changed to respond to the blocks’ types ’stead o’ sprite types. New block types include gems that disappear ’pon being collected & add to a funds # (see next point), a hurt block that causes you to lose health & warps you to the start o’ the room if you lose all health, & a goal block, which now justs closes the program with a printed message in the console that says “YOU WON”—an amazingly worse victory reward what you got from beating Ghosts ’n Goblins for the NES.

  • Inventory system with simple text printing system, used to print the # o’ gems the player collects.

  • A few mo’ animations, including blinking for Autumn when she’s standing or crouching round & an animation from holding up. O yeah, & I finally added the climbing animation; I thankfully already had a climbing graphic for Autumn from some sprite comic I made for later.

’Cause I was so tired & yet also so buzzed on coffee in the last article, for some reason though I mentioned using C++ to make this game, I forgot to mention using SDL2, which makes it look like I did everything from scratch, which would be ridiculous. O well: if anyone cared, they could’ve looked @ the code themselves.

I should also point out that I’m tired & buzzed on coffee today, too, so this article’ll probably be just as incoherent—’specially as I’m publishing it right after writing it, rather than waiting half a year, as is my wont.

I think I’ll next work on developing the Map class into a Level class with multiple maps & ways to warp round these levels. That’s what the open manhole @ the end’s s’posed to be used for.

& where there’s an unsightly hole under it—that’s s’posed to be a warp block with the same graphics as the rest o’ the lower dirt, which I simply neglected to add to the tileset. I should also add that the open manhole’s technically s’posed to be nonsolid—’nother slight o’ersight.

As these screenshots also show, I also changed the resolution o’ the game a bit to fit the wider screens o’ modern computers—from 256 x 192 to 320 x 176, which is the closest approximation to 16:9 that fit within multiples o’ 16 & didn’t make the game space too big or small. Thankfully, I was halfway decent with programming, so changing this resolution only required me to change 2 variables. Changing the camera to fit in the inventory bar only required me to decrease the camera’s height by 2 bars.

After doing the level & map stuff, I’ll probably move on to doing game states & a level state & crapping together some halfway decent victory screen, as well as a less jarring death animation & maybe an intro screen. @ that point I’ll technically have a complete game; it’ll be a lame, immensely short game, but it’ll technically be a fully-working game, & that’s better to finish ’fore finishing the palette system, which is inessential (& the plan to make this, by the way, should ’splain why all these graphics are grayscale).

Download latest source code & see it in its slightly less-sloppy glory.

¿Liked it? ¡Take a second to support this idiot on Patreon!
Posted in Boskeopolis Land, Programming