Boss Battle Creation: Starting the modular destruction system.
As you can tell from the last few articles, I’ve been going all out to create an epic multi-pieced boss battle, today I went a little further and developed each piece a little more:
After piecing together this frankensteinian behemoth, I removed all the current test-targets and replaced each empty section with their appropriate pieces. I also put the same target script on every piece so each one will have their own HP. The remaining sections that didn’t have any pieces were filled with expendable turrets. And just for the heck of it, I threw expendable turrets into every section. The expendable turrets also have the same script that merely checks for a collide with a laser object, which then reduces hit points and if it falls equal or below zero, destroys itself. The wonderful way this system is set up is we don’t have to concern ourselves with how many objects there are, since each section keeps track of how many child objects it has. Once all the child objects are destroyed, it announces to the main ship everything’s destroyed and the ship only moves to live sections for the player.
One major glitch was that the sections were being destroyed before their child turrets. Fortunately, it’s a simple fix. Just nest the current code into a check to see if there’s any child objects.
If the child count is more than zero, the lasers will be ignored. So in our case, once all the turrets our gone, then our main piece will suffer hp damage but only then.
Let’s see it in action!
Not bad for our first attempt, I think. There’s some issues with the heart graphic appearing over the shield but that’s easily fixed by changing its sorting layer and order within it.
There’s also an issue where lower turrets are being shot when they should be ignored while there’s an upper level in existence. I’ll figure that one out for next time. There also needs to be visible damage on the pieces as well as a variety of turrets and actually have them shoot back.
That’s about all for now! Stay tuned!