The Boss Enemy, Part 6

Blake Zoeckler
3 min readJun 20, 2021

--

Objective: add more difficult behavior when the boss is in its second phase.

BossBehavior boolean flag for phase two
BossLives.OnHalfHP edit

To achieve this, we’ll want a new variable in BossBehavior so we can easily tell when the boss is below half hp and thus “on phase two”. We’ll use this boolean variable to control the intensity of the boss’s attacks.

For the boss’s attacks where it shoots lasers while moving, we can just speed up its movement if its on phase two. Since we’ll have the same number of volleys in a shorter period of time, this will also speed up the rate at which it fires lasers and thus makes things much more difficult.

Setup edit for both LaserFanAttack and LaserTrackingAttack

Here are the different phases side by side. The boss is quite a bit more difficult in phase two now.

For the beam attack, we’ll have it fire multiple time if we are on phase two. After firing the beams, it will check if we are on phase two and have yet to fire the required number of beams. If both are true, we change to the tracking state, which will cause the boss to fire again.

BeamAttack.DoFire edit

We can also speed up the speed of the tracking and by changing the duration based on whether we are on phase two or not.

BeamAttack.DoTracking edit

Here’s the result. Two beams in quick succession might be an unexpected surprise.

Finally, we’ll give the ability for the boss to fire two volleys of missiles when on phase two. During the act method, it will check if the boss is in phase two, half the duration has pass, and we haven’t fired two volleys already. If all that is true, we’ll fire another volley of missiles.

MissilesAttack.Act edit

With that, we are finally done with this boss enemy. Not only that, but all the features we want for this game are all done! The only thing remaining is to change minor details and add a little polish until this game is as close to perfect as we wish.

--

--

Blake Zoeckler
Blake Zoeckler

Written by Blake Zoeckler

I’m a passionate and talented software engineer seeking an opportunity in game development.

No responses yet