22Multi-Phase Boss Encounter in Unity, Pt 3

Scott Sourile
2 min readNov 7, 2023

--

In our latest venture, we embarked on an iterative journey to refine the actions of my boss in Unity, ensuring that its progression through different phases not only feels natural but also ups the ante for the player’s challenge.

The Plan and Execution

We started with ourFinalEnemyController script, which already contained a robust framework for managing the boss's state, movement, and attack patterns. However, as the game's design progressed, new requirements emerged. The goal was clear: make the boss lock onto the player's position and fire rapidly in Phase 2, without the need for it to move along the axes.

A Shift in Strategy

The initial design involved a separate sprite controller for the enemy. This was a holdover strategy from my Advanced Drone Enemy type that required simultaneous movement and aiming. It was a great and effective solution for that particular challenge, but not for our current boss, who would be standing its ground and only rotate to face the player in its second phase.

The revelation was significant: we could streamline our approach. By rotating the parent object directly rather than scripting different sprites; we could achieve the desired effect without an additional controller. This simplification not only cleaned up the hierarchy but also reduced the complexity of our code.

Tackling Laser Instantiation

Even with the streamlined controller, the boss’s lasers were misbehaving, not aligning with the new orientation as intended. We revised the FireLaser method to adjust the fire rate dynamically based on the current phase and ensure that the lasers would instantiate in the correct direction — that is, wherever the boss was facing. This involved setting the laser's rotation to match the boss's and ensuring the movement direction was updated accordingly.

The Path Forward

While progress was made, there were still kinks to be ironed out. The lasers weren’t quite hitting the mark, a puzzle we plan to solve in our next session. We’ll need to delve deeper into the FireLaser method, perhaps introducing more granular control over the laser's instantiation and travel vector.

Looking ahead, Phase 3 looms on the horizon. We’re considering introducing a shield mechanic to ramp up the challenge further, alongside faster movements to really test the player’s mettle. How we’ll integrate these while keeping the boss’s behavior coherent and engaging is the next exciting challenge.

***

Iteration is at the heart of game development. With each tweak and adjustment, our boss becomes more menacing, more engaging, and a true test of skill. Stay tuned as we take on the final touches, turning a formidable enemy into an unforgettable final challenge.

--

--