Creating a Boss Battle

Jason Schneider
2 min readFeb 21, 2022

In order to create a Boss Battle; we, of coarse; need a Boss. Then, we need to decide on what type of weapon/weapons we want it to have and how much life. After making these decisions, and setting up a prefab of the Boss, we can get to coding its behavior.

I have decided to have my Boss enter the top of the screen at a random location and move to the centre of the screen. This can be accomplished using:

in a new BossEnemy script.

I have also added 4 cannons to the Boss; each of them targets and fires at the player. Dragging and dropping the Boss prefab into the scene and moving it off the top right of the screen and pressing play, gives:

Now, we need to add code to the SpawnManager script to instantiate the Boss when a predetermined number of enemies are spawned, or once all enemies are destroyed.

We will then need to create methods in the BossEnemy script that adds points to the players score and reduces the health of the Boss when hit by a laser, the player’s shield or player. We also need to destroy the Boss when its health reaches zero and end the game.

This I will leave to you.

--

--