Friday, February 12, 2010

I Can C Clearly Now

Hah, a pun! I didn't even get to the body of the text before I started throwing puns like Ryu throws hadoukens. Right then, I'll try to get to the point, I figured out something that has been bothering me for days, the cause of my lack of progress or posts. I've been in the process of building the functions and classes that one day will form the backbone of Paper Zeppelin, the player controlled objects (yeah, plural - I'm dropping some multiplayer on ya) the enemy types and more specifically, the bullets. For now, as a test, I wanted to create new bullets ( with a Bullet Bill placeholder sprite) that would then travel in a direction based on the way the player objects are facing. The Epic Fail occurred when they would simply not go in any direction that wasn't down and to the right.
So into the code I went. "Maybe it's the bullet update code," I thought to myself as I went in and started making the little bullets fly in a bunch of directions. "Nope, that's not it. That seems to work. Maybe they're not being created correctly," I continued aloud, because I was home alone with my cat. That wasn't it either, since I could change the vectors manually to about anything, and I did. "We're not getting information correctly from the player then, *sigh,*" This, was what I was most afraid of. Basically, if my player controlled object wasn't talking to my other classes, then I was missing something fundamental about coding in C#. So if that was the problem, the progress towards enlightenment thus far, has actually been in the wrong way.
Either way, in I went, checking the Return functions and the other little bits of code, frustrated that it wasn't working correctly. Last night though, I came across the true problem - I screwed something basic. I discovered that if I were to define the direction the player is facing instead of using conditional statements, then it did it correctly. I'll rephrase that. When I told the code explicitly, "Hey, code, make this a 7, no matter what and don't argue about it," instead of, "Make it a 7 sometimes, and a 6 if it's a Sunday." Or, in pseudocode:

Defining looks like this -
facing = 7;

Conditionals look like this -

if Sunday = true
facing = 7

With that out of the way, the problem was that my conditional statements, were all stupid, like I coded them while snackered. I've never been so happy to have done something so dumb. My grammar was correct, my structure is correct, but I misphrased a sentence basically. Now, I just need to get the rest of those little piggies moving.

- In non-development news, I just wanted to say thanks to the several people that are now connected to me with a Facebook, um, tether? I've no shame really, and will probably approve anybody to be cool kids. For ease, my Facebook icon is the exact same one as my CID icon and my Gamasutra icon. Don't be bashful, besides there may be a time when I may be able to give something out to the Cool Kids.

No comments: