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 XVI

Mart Cart Madness:

This was a level I’ve been sitting on for a while, & I finally got round to finishing it — which mainly meant drawing all the graphics.

I still worry that the level may be unfair. I make it look easy in the video; but I’ve played this level a’least 100 times as I tested it, ‘specially recently, & wary-eyed viewers should be able to spot that I’m jumping before any fresh player should know what’s coming. In truth, I just have this level burned into my memory & was just jumping on pure muscle memory.

The problem is, your character goes so fast & the level’s still so cramped that you have to be tight with your timing. It’s very easy to nick a wall with your very edge down in the warehouse area near the start. But I don’t want to slow your character down, & adding extra space would require me to significantly redo much o’ the level, since I’d have to push the rest o’ it back.

That said, it’s not too much o’ a problem: dying is just a snap o’ a rubber band: you lose 2,500₧ in a level that nets you o’er 10,000 on a single victory, & the level’s short. This is why I wanted you to go fast: auto-moving levels are boring as boards when they take too long & go so slowly. You know you screwed up when the player is holding the forward button futilely trying to speed things up. I can a’least say that I doubt a player would do so in this level.

Interestingly, the warehouse part near the end has much mo’ room for error: thanks to the walls being all springs, you don’t lose any health or die from the vast majority o’ errors, allowing for unlimited errors. This probably could’ve worked better earlier in the level; then ‘gain, maybe it’s better to have such a parachute near the end, when you’ve got mo’ to lose. I do like the calmness o’ this section.

Beating the level is simply the player cart sprite checking if the player has gone past the right side o’ the level, which could probably be exploited somehow. Due to a quirk o’ how maps are laid out, I had to align the end with a space on the far left side o’ that Y position so the player wouldn’t bump into anything on the left. Similarly, to make the cart start past the left side o’ the level, I had to put empty space on the far right o’ the starting Y-position, which is luckily just a large clump o’ solid blocks that should ne’er be seen by the player in-game. If you look @ the map in Tiled ( in the Github project: resources/maps/land-shop-1.json ), you can see the seemingly arbitrary down near the lower-right.

The way the player’s cart sprite works is simple: it just checks if it has a horizontal direction & automatically moves in that direction. The springs change your sprite’s direction. The upward springs down in the 1st warehouse area nullifies your cart’s horizontal direction & ‘stead sets your cart’s vertical direction to “UP”. With that, your cart automatically moves upward till it reaches a hard-coded Y-position, & then nullifies its vertical direction & sets its horizontal direction to “RIGHT”. It’s not friendly for reuse in other levels, but I don’t plan to make ‘nother cart level. Remember the wise words o’ Programmer TV Tropes ( ¿Computer Tropes? ): YAGNI. The sprite also checks if you collide with anything to the side or ‘bove & damages you if so. Springs aren’t solid, so they don’t count as collisions.

Palette changes are simply done by placing graphics-less blocks in select spots, which activate when onscreen.

The next level will probably be a sky level I’ve been working on for a while…

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