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 XXXVI

Crying Lightning

No, I hadn’t taken a break — it just took this long to complete something. I think I’ve been hinting a few times in previous updates that I was s’posedly close to done with this level; & indeed, most o’ the general level layout had been completed, save adding in extra gems & a few extra crevices ( including the diamond, which I realized late in development I’d forgotten to put into this level ).

As usual ’twas the aesthetics that took the longest time. Foremost was that fancy treasure-chest-opening animation, which seems simple, but took a whole day off to accomplish. As always, this involved many silly hacky code that gives the illusion that this is a sane world. To keep my sanity & not gunk up the player sprite’s code with a bunch o’ code that 99% o’ the time is irrelevant, starting the chest-opening animation replaces the player sprite with a totally different sprite in the same place with the same direction. The rest is a series o’ moving the sprite round & changing its graphics frame. & ’course, the sequence o’ movements are handled the same way I code just ’bout everything else, a simple finite state machine switch statement.

The mo’ hacky part o’ this code is that, due to the limitations o’ polymorphism & being so cheap in memory that I didn’t want to waste precious frames on dynamic cast or extra variables, I use the treasure chest’s top_speed_ & start_speed_ members to handle how much the top half o’ the treasure chest is open & how high up the keycane is. Hey, they’re not used anywhere else; they might as well pull their own weight. Speaking o’ the keycane: it’s actually bigger than the bottom half o’ the chest, so I had to shrink it & make it grow as it rises till it reaches full height so its bottom doesn’t poke out from below the chest.

You’ll note @ the end o’ the time-score run that I was able to end the level before the animation finished. Though I do, indeed, want swanky animations so this game looks halfway professional, I insist on not having it slow gameplay too much as so many games do.

& then there was the sound effects, the last jingle being the only thing I crapped out in some MIDI player & still sounds weird — mo’ like eerie alien music than a celebratory jingle.

While making the treasure-opening animation, I implemented fade-ins & fade-outs ’tween game states, a long-awaited change, as the transitions before always looked abrupt & jarring.

I have mixed feelings ’bout this level’s difficulty, but I feel they balance themselves. The level’s short ’nough that I feel like it may be a bit too easy for a 3rd-cycle level ( actually, I originally planned to have it be a last-cycle level, but decided to switch it with “Hoot Chutes”, which will definitely be harder than this ). I considered trying to lengthen it, but it’s actually the length I generally aim for for these levels; it just seems short ’cause many levels, ’specially late-game levels, don’t end up that way for some reason. ’Sides, it feels complete the way it is.

Contrariwise, the gem & time scores are a pain to get. For the gem score, it’s ’cause you have to be in certain places, such as ’bove every fading-in-&-out cloud platform & in that tight space just to the left o’ the beginning, which doesn’t leave ’nough space to run ’way from the lightning. Meanwhile, you have to time jumps o’er the fading cloud platforms & the lightning, & unlike normal playthrough, you can’t wait for both to be aligned well. For some reason I insisted on making these scores as anal as possible: the time score is as quickly as I could possibly do, & the gem score requires you to collect every gem.

However, we could say these challenging scores balance the easy normal gameplay. & as I prove in this video, you can beat both the gem & time score without getting hit once ( which is better than some other levels I’ve made can say, such as “Mart Cart Madness”, which, I think, requires a hit just to beat it @ all ).

& despite these mixed feelings, in general I think this level has a solid gimmick, which surprised me, as I had misgivings ’bout it @ 1st. I was surprised by how fun ’twas to figure out how to get all the gems & get to the end without any delays while maneuvering round the lightning. You’d be surprised by how subtly different timing can make going into that left crevice @ the beginning go from a guaranteed hit to narrowly dodging the lightning. Unlike most gimmicks I lazily program, this one has no randomness, too: the lightning’s on & off durations are always the same length o’ time. I also like how the cloud monster’s momentum works: it’s faster than you, obviously, since otherwise you could just outrun it; however, it’s acceleration is worse than yours, so it takes a long time to turn round & chase back after you.

Looking @ it now, the only weakness I think this level has is that the diamond is in a rather lame place; but my other idea, having you get it by reaching some high place just left o’ the 2 rows o’ cloud platforms in the middle o’ the level from bouncing on a cloud, was e’en lamer. My logic for this hiding place was to hint @ it with the hiding place @ the beginning & the way you have to go through clouds squeezed together like that @ the rightmost end o’ the level. Also, it’s right @ the end as a way to “challenge” you not to be to hasty & grab the treasure chest being looking round.

The next level I’m almost done with is “Boskeopolis Underground” — which would complete all 4 sewer levels. However, that still needs a lot mo’ sprucing up. Also, I’m almost always wrong ’bout what level I’ll finish next, so expect a completely different level next.

Posted in Boskeopolis Land, Programming