Making A 2D Shooter — Getting Bossy

Joshua Nielsen
5 min readDec 11, 2021

--

Giving the game a satisfying conclusion by making a boss enemy

Photo by Gladson Xavier from Pexels

And now for the grand finale! We have looked at a lot of ways the 2D shmup has evolved from a simple but functional game to something more complex, interesting, and challenging. Now we will look at arguably the biggest change to the game — a new enemy unlike any of the others. A boss enemy.

The Goal

The idea here is to provide a climax to the game experience. The player has been challenged with waves of varied enemies, but how to bring it all to an end? As many games before mine have done, I have chosen to make a unique and challenging enemy as a final challenge.

I have taken inspiration from other games of the genre and have made an enemy that consists of multiple different components and multiple stages to the fight. Only by defeating the boss piece by piece can the player emerge victorious.

Making An Entrance

The first thing I wanted to do with my boss enemy is to have it make a grand entrance. After all, you can’t have Darth Vader or Doctor Doom just walk into a room like any of their minions, can you?

For this, I went with a fairly simple approach. I had the boss enemy arrive from the bottom of the screen, but unlike other enemies it is at a distance. It’s not on the same plane as the player yet, so they’re not fighting at this point. The idea is just to let the player have a sense of the enemy’s scale, as it lurks beneath them.

As soon as it makes its way entirely up the screen, it then travels up to the player’s plane and comes down to confront the player.

The boss shows up

Within Unity, this was accomplished in a literal fashion. At start, the boss really is on a different level of the Z axis than the player. This actually wouldn’t prevent the player from attacking in Unity 2D, but I have also shut off all of the collision detection at this point. The fighting will come soon enough.

Going Through Phases

In a related matter, I also wanted the boss enemy fight to have multiple stages to it. This is mainly because I made the boss too big to fit entirely into the game screen. So, the player will start fighting one section of the boss ship, and then move onto another, and another.

One phase change for the boss is rotating to bring more of its weapons to bear

From a technical standpoint, this is actually nothing truly new. I did not describe it as such, but other enemies in the game already had multiple “phases”. For example, the beam cannon and agile enemies (described in my article on enemy changes) start out by moving onto the screen, then they attempt to target and attack the player, then they move horizontally to a new position, and then they repeat the last two steps until they’re destroyed.

This is done by just having a logical flow to the enemy’s actions. Is the enemy in position? If so, has it targeted the player? If so, is it ready to fire? And so on. Simply a series of if/else scenarios.

On Offense

Once in fighting mode, the boss attacks through a collection of “turrets”. These turrets attack much like other enemies, but they have no independent movement. There are three types of turrets on the boss ship: lasers, missiles, and beam cannons.

The boss ship’s laser and missile turrets
The boss ship’s beam turrets

There is little new technically about these weapon types. Check out my earlier articles on player and enemy changes if you want some more explanation.

The one difference is that missiles are new to the enemies. They act very similarly to the player’s powerup homing missiles, but with somewhat less homing capability.

On Defense

Mostly the boss defends itself by trying to destroy the player, but it does have one purely defensive ability — a shield.

This shield is a bit different though, in that it is more potent than any shield we’ve seen in the game so far. It not only takes more shots to disable than even the player shield, but it also recharges after a short period. No one said defeating the boss would be easy.

The boss ship’s shield

This shield operates very similarly to the shields of the player and the other enemies. The big difference is its auto recharge capability. To accomplish this, it was necessary to create a timer when the shield is disabled. When the timer reaches zero, the shield is replenished and reactivated.

The End

If the player is able to battle through the multiple phases, destroying the enemy’s weapons, they eventually get the opportunity to attack the boss ship’s core. If they can then destroy that, the enemy boss is destroyed in dramatic fashion, bringing the game to an end.

End of the boss ship (Spoilers!)

The destruction of the enemy boss is just another phase for this enemy to eventually reach. The explosions are a prefab that are instantiated in a collection of predetermined locations in an effort to make the enemy’s end more memorable. The end itself comes with an even bigger explosion before the boss object is destroyed and removed from the game.

The end game message is supplied by the wave messaging system that was described in the previous article on UI changes. I suppose a cool cutscene would make for an even better ending, but I haven’t come that far just yet. Hopefully in the next game!

And that concludes both the game and this series of articles. I hope you got something out of this retrospective on my first Unity project. Thanks for reading.

--

--

No responses yet