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:

The base of the ship. Only half to save space. I put two of these up and mirror the other side.
This is the shield covering for the front.
A turret that lies on top of the shield covering.
‘arm sleeve’ goes on top of the front arm like sections.
Another gun for the front.
Body bits for the heart of the ship. Every videogame needs a biomechanical menace!
This covers the body bits for a layer of protection.
One of the topmost pieces. Still a bit rough. Everything will be tweaked during the development.
Currently the expendable turret.

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!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store