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.