A House of Cards

The title of the day was almost something about a fax and then I realized that almost nobody uses a fax machine. Further anybody that reads the development diary of an indie game probably thinks that a fax machine falls into the same category as a wax tablet or something made out of papyrus. So that went right out the damn window as far as a title was concerned.
Which is kind of shame really, because the analogy really held up with today’s bit of coding. Getting back to the cleanup of the C# code, I got to putting the Fortress (and by extension, anything that acts like a Fortress Enemy, like Turrets and Rocket Launchers) together correctly. The first enemy that I did was the Fighter Plane. The thing is that a Fighter only shoots in a single direction. So when I had the Fighter Enemy phone back to the mothership and ask for a bullet, there was only 1 direction that said bullet would go in.
Everything the feck else though, has a menu of options with 360 things on it. So sending the request (which is just a single number – cause I like those) suddenly had to include a lot more information in it. So I thought that I would send a code up through the request, a short series of digits that would represent different aspects of the speed and direction of the requested bullet. So the code uses the 1000’s place for the X value, the 100’s place for the Y. So a value of 3200 would be 3 to the right and 2 down.
It didn’t take me long to realize that there was almost no way to transmit negative numbers this way, which is kind of problem because anything that goes to the left or up requires that one of the values must be negative (the value 0,0 is the upper left hand corner after all). So fix that I added markers in the 10’s and 1’s place to represent the negativity (so negative!) of the numbers. So 3201 was 3 to the right and 2 up.
This of course fell down hard because I was adding bad values. I wasn’t changing them into their absolute values, so adding -100 and 300, just got me 200, which is just wrong in so many bloody ways.
After fixing that, the turret would shoot in the opposite direction of the player, but at least now it was doing so consistently. So a tweaked some functions and…broken. Tweaked some more and found the same issue. Make a couple minor adjustments and then…still shithoused.
Eventually, I added a “-” to the front of the directions and it just worked somehow. Which brings me to the titles. You see, it works now. It’s completely portable. I have no exact idea which of the things that I did fixed it, or which of them I’ll break it with if I decide to dick with it. Thankfully, it works so I won’t have to touch it. I can just enjoy it and the effort that went into it, like, well, see the title.

Leave a Reply

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