The Boss Enemy, Part 6

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.

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A Guide to Gradle plugin

Dockerize Your Selenium Grid Setup

A beginner guide to Neo4j

How To: 302 Redirect DigitalOcean

the device’s status bar is controlled by rendering a StatusBar component

Introduction to backtesting trading strategies

Full Stack Web Development - 2

Launching A WordPress Application With MYSQL Database in K8S Cluster On AWS

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
Blake Zoeckler

Blake Zoeckler

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

More from Medium

Week 23: What’s in the Menu?

Making a Dash Mechanic for your game

Connecting GitHub to Unity

Setting Up a Patrol Route: A Modular Waypoint System (Game Dev Day 60)