Creating a Boss Enemy — Part 2, Boss Projectiles

Frank Warman
3 min readJun 7, 2021

We have our Boss moving, but now it’s time to make them more dangerous by giving them some shooting abilities!

My Big Bad Boss will have the ability to shoot fireballs that explode, and also Freeze Asteroids to slow the Player down and make them more vulnerable!

It’s raining projectiles!

The Fireball

The Boss’s Fireball is actually just a reuse of the Kamikaze Enemy’s bomb with different settings and an extra animated sprite.

The Fireball preview

All the pieces in the new Prefab:

The EnemyBomb script that is attached to the main Boss_Fireball parent:

https://frankgwarman.medium.com/new-enemy-kamikaze-enemy-46284789fda7 to see the creation of this bomb/script

Boss Fireball in Script

Now for the logic inside the EnemyBoss script. First we need some global variables (which are almost identical the regular Enemy firing function):

And inside our Update() function (or inside a new function called within Update()) we have our firing logic:

ShootFireBall():

Now our Boss will shoot Fireballs randomly between 1 and 3 seconds!

Dropping Freeze Asteroids

Dropping the Boss Freeze Asteroids could be done the same way as the Fireballs, but I chose to show you another way to shoot/drop projectiles; through a coroutine!

Here’s the link to creating the Freeze Asteroid Prefab: https://medium.com/nerd-for-tech/negative-pickup-freeze-asteroid-30b3582dc9f2

Like always, first some Global variables to work with:

Basically the same.

Then we’ll create the coroutine:

This time, the random drop time is between 1 and 5 seconds, plus an additional half second variance.

Now we can start this coroutine in the Start() function:

The last thing we do is to make sure we link both prefabs to the correct slot in the Boss Enemy Inspector!

That’s it! Nothing too crazy, but in a short amount of time, and by using two different methods, our Boss Enemy now shoots some projectiles and makes them that much more dangerous!

In the next article we’ll cover the Boss’s defense mechanism — it’s Asteroid Belt shield/attack!

--

--

Frank Warman

Audio Engineer turned Unity Game Dev. Will be combining both my skillsets when appropriate, and will be documenting my Unity Dev growth in these Medium Articles