June 2012

Say my name

The enemy thing turned out to be more involved than I was anticipating, though not actually because of enemies. I ran into an issue trying to calculate line of sight based off of the collision detection I was using. There’s a tile-layer object that you just fill up with graphics, and set collision polygons for that’s supposed to strreamline level design. However, there’s pretty much no way to detect collisions with it; everything is automatic and happens “behind the scenes.” The other recommended way of doing this is to create little invisible blocks that you overlay a non-collision image. For some reason, all of the collision routines work with that perfectly.
So I had to go through and add extra little objects to everything, and I noticed that I was starting to get a crapload of runtime errors involved with having more than one object with the same name.
What I was doing was naming everything collide-able “solid,” “ladder,” or “oneway,” and testing to find the name of the object the player hit. Names aren’t really meant for that, so instead I ended up creating different classes for the different types of blocks.
I then spent a couple hours tearing my hair out over trying to figure out how to test for the class.
GetClassName returns t2DSceneObject. Well no shit, but it’s a member of multiple classes. How do I test that? I dug through the messageboards until I found someone from 2006 who was trying to do the exact same thing as me. Turns out the sub-classes are actually called ClassNameSpaces.
So now I’m essentially back to square one, with all of the collisions working the way that they’re supposed to. Visually, the game doesn’t seem to operate any different than before, which is kind of discouraging, but at least now it’s set up to make enemy implementation a little easier. Of course, I’m about to spend a week away from my “second job,” and I decided not to try and bring anything with me. Aside from the ridiculous amount of work it would take to get my laptop set back up with Windows and get everything transferred back over at the last minute, I don’t really want the distraction. I like sitting at my desk and being able to put myself in the right mindset to get stuff done.

Making Enemies

I had a duty shift at work yesterday, so I couldn’t work on coding at all, but I spent a lot of time mentally working through methods for ramps and ladders and talking it over with some of my nerdier coworkers. I came home today and immediately sat down at the computer to put everything into motion (pun fully intended).  It took some finagling, and I’m still not 100% satisfied with the movement style of the dude walking up a ramp, but I managed to get ramps, ladders, and one way platforms finished off in just a few hours.  I tested everything out, and I’m satisfied that collision detection is about as done as it’s going to get.  Now it’s time to start designing some enemy behaviors.  I think I might try and translate some of my Python source code over from my deployment project; I had all of the Feudal Japan level bad guys fully programmed, and while the physics are going to be a little different, I can at least use it as a guideline.  Of course, having worked all day yesterday, I’m ridiculously tired, though I should have pretty much all of tomorrow to work on things.  I should probably try and pace myself to make sure I don’t get burned out too quickly.  There’s also a tornado watch in effect right now, and I can hear thunder off in the distance.  I’ve got a bad habit of not saving my work often enough, and perhaps I’d be better off taking a nap for now and not tempting fate.

Concept art for final boss- stage 3