Smoke and Mirrors

Let’s start this off properly, although “properly” precludes any kind of irony laced drama regarding the last post. I won. It doesn’t surprise me given the record of my brain versus, well, most things, but I feel good about it anyway. Yes yes, I am fully aware that talking about the intellectual machismo that my gray matter has in spades borders on the wanky, and is well into the zone of self congratulatory, but I’m going to go ahead and give this one to myself. So here goes:
The issue, like I said previously, was that once anything touched the player they would quickly die thereafter, kind of like they’d seen that video with the creepy well girl in it. For almost 3 days I fought with this, and was firmly convinced that it was a systemic error.
Now, the thing with systemic errors is that they are an issue with the core logic of the system. Somewhere in the code something isn’t going in the correct order. I hate these so hard it hurts sometimes, but thankfully they are rare…like unicorns…with syphilis.
So, in an effort to make the program a little easier to navigate (and find the bug) I got to moving pieces of the code into its own functions. I call this type of coding “Modular” although I’m sure that real programmers would call it something different (possibly just “Correct”). What that means is, instead of having long sequences of code, everything is built into discrete functions that handle very specific things. So, if something is wrong it becomes very easy to narrow down the source of the issue. At the same time, adding functions becomes are easy as adding Functions (see what I did there? I used “function” as a synonym for “ability” and Function like a computer code chunk {damn this post is getting wanky}). It’s probably best code practice for either reason, but it does take a little extra effort when you’re just trying to make something work.
So I did that for all of the player interactions. So now there is a function that accepts a player and checks to see if that player is touching anything. Instead, it was still broken. Also, the smoke and fire for the player still didn’t work.
For shits, and the possibility of a giggle, I did the same thing for enemies. But they still worked just like they had before.
The thing is, the new player function that I had built didn’t give a damn about where in the program it was. It was perfectly content to accept player variables and do its thing wherever I felt like putting it. If my bug was indeed a systemic error, then the function should work if I put it someplace else. Remember that a systemic error (fuggin’ things) are issues with the logic and the order of things. So if that is the problem, the non-working bit of code should work correctly provided it is in a different place.
But it didn’t. I would still get hit by a bullet that seemed to poison me, and cause a lingering death. Yet, I realized that the problem wasn’t systemic then, it was just a regular bug that I couldn’t figure out. On the one hand, those should be easy to find. On the other, I had missed this one. So I started comparing the enemy and player collision functions, since they are on a basic level, almost identical. The “almost” bit will be important in a minute.
What I had continued to miss though, is that somehow the addition of bullet collision for players had also broken the smoke and the fire that the player sprite summons up when they are damaged. For some reason, it would play for a frame, and then blink out. Play, and then blink out and kill me in the process.
The player collision function though, it was checking for things from something called the spriteList(). It holds sprites, easily enough. Sprites are everything except for players, ground and enemies. Then it hit me – the sprites were damaging me. I didn’t specify that I didn’t want everything on the damn list to hurt, just a very specific subset of things that might be on that list. Instead, the smoke and fire that was being created by the player sprite were dealing additional damage to the player, causing a quick death.
So I tweaked it…and it worked…then I swore in some kind of furious joy. It was the same kind of outpouring of emotion (positive and chest thumping) that I throw out after beating a tough Ninja Gaiden II boss. So that works now. The current score is 0 to 100,000,001 and counting. I need to learn me some Calculus so I can get a proper workout.

=D

– Speaking of Paper Zeppelin, now that everything that can kill the player, will kill the player, I’m finding that the game is kind of tough. Player HP doesn’t regenerate, and things shoot the crap out of you for lots of different angles. I was thinking that I should fix that, but then realized that Paper Zeppelin isn’t too terribly long in the first place. If being short and hard worked for Nintendo games back in the day, it’ll work just fine here. Getting to the final stage on the Hard Path should be borderline impossible for a first time player. I’m good with that. Now back to building.

Leave a Reply

Your email address will not be published. Required fields are marked *