Creating a Boss Enemy — Part 2, Boss Projectiles

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: 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:


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:

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!



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