Journal 144 — Unity Project Development, 2.5D Shooter

Chris Nielsen
4 min readJan 15, 2022

--

Objective: To add a mid-level and final boss

In the previous articles, I have the basic UI working, along with weapons, power ups, and the ability to restart. In this article, I’m going to add a mid-level boss and a final boss.

Ultimately, I plan to have 5 or 6 normal waves, then a mid-level boss, then another few waves, and the final boss.

I’ll take a larger size helicopter game object as my mid-level boss, and I’ll use a B2 stealth bomber as my final boss. I’ll give them some animations and give them a couple sets of weapons, both missiles and bullets. I’ll also experiment with a new set of waypoints and try to come with random patterns for weapons to fire, and also it will take several hits to show damage and destroy them.

Mid-Boss

For the helicopter mid-level boss, I added a couple empty game objects for gun and missile prefabs. I also used a mesh collider and Rigidbody.

I reused the previously created script for the gun location to spawn projectiles, and then I added a new script dedicated to the missile location for the missile projectiles. This was to simplify the code to call the fire function instead of trying to call the same script on two child objects. Eventually I’ll look at optimizing how this is handled, but for now it works.

I then set up a new set of waypoints for the mid-level boss to follow.

I made a new enemy sub-class to: follow a different set of waypoints, use two different weapons to instantiate, and have a different fire rate. Also, I wanted to record several hits before the enemy is destroyed, and give a different number of points when destroyed.

In the GameManager, I needed another Waypoints getter-setter to find and add a separate set of waypoints to the mid-level boss when instantiated.

Earlier, when setting up the player and enemy and their weapons, I was running into collider issues where the enemy would fire and take damage from its own prefab. I fixed this by setting up different layers for the player and player weapons, and enemy and enemy weapons so they ignore each other in the Project Settings.

Now, let’s see this in action.

Final Boss

For the final boss, I set up similar to the mid-level boss with the same components and two weapon spawn locations.

I made a different set of waypoints than the other enemies.

For the weapon spawn, I decided to use the triple shot spread in both spots, which is more difficult to avoid. One issue that came up in doing this is I needed to set the 3 child prefabs in the triple shot to the enemy layer. I used a function MoveToLayer to handle this.

I made a new final boss script that uses the Enemy base class.

In the Game Manager, I made a new getter-setter to assign the final boss waypoints.

Finally, let’s see this in action.

Thank you for your time!

Next, I plan to set up the menu screen and add some background music and sound effects.

--

--

Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.