Space Shooter Challenge: Boss Pt 1 — Setup and Movements

Calum Slee
Level Up Coding
Published in
3 min readJul 6, 2021

--

The final challenge for my Space Shooter Game, was to make a Boss Enemy.

First, I needed to find a suitable candidate. Filebase had a wicked looking Dreadnought that I exported to Blender to play around with. I ended up separating the small side turrets, and the three large front turrets so I could manipulate them separately of the Boss in my game. I also copied out the yellow mine-looking things on the side, and captured png images of everything to import in Unity as Sprites.

In Unity, I made use of many Empty GameObjects to store the different components, much of this was thought of in advance, based around what I wanted to be manipulating differently at any given point.

I had an Object holding the three Large Turrets, and for the smaller side turrets, I contained them to each side, so I could choose to only fire certain sides off later.

For the Mines, I simply used empty objects that I could later use to Instantiate Mine Prefabs in the suitable locations.

For my first Boss Behavior, I simply wanted to introduce the ship onto the screen before retreating. Eventually, it will deploy some mines, and have a shield active so its initially invulnerable.

To create this, I used a Coroutine that is called in the Start method. In this Coroutine, I want to set my position and rotation appropriately with some variables. These are in place for the multiple states we are going to create for the Boss. Then while the transform position is above the desired stopping point on the screen, I simply used transform.Translate in the downards direction, running every frame.

Next I added a pause, this will be where the mines fire out.

Afterwards, I inverse the previous while loop to return the Boss offscreen.

Then I call a StateSelector method.

In this State Selector, I use a switch statement that receives a random number, to then call different Coroutines for the multiple states.

These various states look quite similar to the initial movement state, below is an example of one of the sideways movement variations.

Lastly, here are the Vector3 variables I used to create the different spawn positions and different rotations.

Next step is to look at adding functionality for firing off the different weapons. Read Part 2 here!

--

--