Not a bad week. Created an inter-entity collision behavior and a system whereby entities can interact with each other, both of which will be necessary to get attacks working. I actually ended up using the same kind of stacked enum faux-assembler that I had been playing with for my Color class, so that time may not have been entirely wasted — though, in point of fact, I looked up a haxe real-time script parser that I could also potentially use today, which probably would be a more flexible solution, so who knows? That’s not important at this point anyway: What’s important for now is that the entity collision behavior is in place.
The question is, does it actually work? And, uh, for various reasons the answer to that is a little bit slow in coming. There were bugs in the entity editor I had to fix. Then there were bugs in the level save code I had to fix. Then there were bugs in the game initialization code I had to fix… And so forth. It was an experience rather like building a working airplane in your garage and then opening the door to find that you’d absentmindedly left a pile of rocks in your driveway. Well, I think most of the obstacles have been taken care of now, and there’s just one problem left before I can give this behavior code a proper test run: Getting the level to actually recognize when it’s fully loaded and place all of its entities.
It’s a rather tedious problem, just a sequencing error. Right now the initial level is made active as soon as the file is loaded but before all of its secondary data (details, entities, background) is fully loaded. The challenge is making sure it knows when it’s finished loading, which is actually surprisingly tricky since there are so many little moving parts. I suppose an easy solution would be for it to just check periodically, but that would be messy and inelegant — and, moreover, doing this the right way from the bottom up will make any future changes and improvements that much easier to manage.
Well, it shouldn’t be that much trouble, but it’s somewhere in between amusing and exasperating that I keep getting blocked trying to do the simplest things by hiccups in the code. Still, each time I fix something like this it feels deeply rewarding, like sanding a wooden surface until it’s perfectly, pristinely smooth.