Since I’ve been kind of in-between major components of the game, I’ve been spending time just looking through my code, figuring out things that need doing, pursuing components which are, perhaps, not particularly vital to the project but are personally interesting, and just generally dicking about. Somewhere in between procrastination and vital work, smooshing bugs where I find them, noting down things to pursue when I get a chance, and thinking probably way more than is actually practical about fancy expansions to my color class.
I’m about ready to settle down to my task list, though.
By far the most pressing thing on the list is getting melee attack registration working. It’s a bit odd that I’ve put it off for this long, but I kept being unsure exactly how I wanted to proceed and tabling it for later. Given the experience I’ve had over the past week looking through the byzantine horror show that is some of my old code, I suspect I may in fact be better off for this delay. The two big questions that have stalled me are a) how do I make a system for precise collisions that aren’t tedious pixel-by-pixel affairs that bog down the code, and b) how do these collisions interact with entities?
Today I think I’ve arrived at some satisfactory answers.
To the first, It occurs to me that rather than going through pixel-by-pixel, I can easily skip through and, in the case of any objects that aren’t weird lattices or anything, have detection that’s still pretty accurate while expending 1/16th or less the processing time. Since only a few of these are likely to be processed per frame, that should be entirely satisfactory. To the second, I think it makes sense for each attack to be its own entity, even if it only exists for one frame, and to then apply its damage to any enemy entities that it can detect collision against. This is a particularly appealing approach because it means that projectile attacks should be able to be implemented in a fundamentally similar way, just replacing an instantly-disappearing attack entity that collides with everything in its range with a fast-moving attack entity that destroys itself after the first object it collides with.
I’ll be working on these behaviors over the next week, as well as keeping an eye on what modifications will need to be done for other kinds of entity collisions such as for moving platforms and destructable walls. Once I have that stuff working, I can see about building a test level with enemies and tuning up the basic gameplay, as well as adding any additional animations that will need to be created for the new interactions. I’ll probably be bouncing back and forth between that stuff and adding the remaining features to the code base for at least the rest of the the year, but once I hit that point I should have a rock-solid base to expand upon.