Creating The Boss Fight! (Part 5: Animation)

A Boss fight wouldn’t be a Boss fight if the Boss didn’t do anything during it. I’m adding some different behaviors which the Boss will do in each stage of the fight to keep things interesting.

Some of the animation in the Generator fight phase

Today’s Objective: Animate the Boss’s movement in the 1st “Generator Phase” of the boss fight.

First, I create some simple animations for the Boss.

One animation per task, due to how I want the fight to play out.

Boss reveal
Boss from left
Boss to left

Etc, etc…

I also create some Animator parameters, for what little transitions I do need:

A very simple and clean animation setup. Most nodes don’t need to be connected, as they’re played from code.

I use Animation Events to tell the “BossFightManager” code when certain things happen in the animation

The Events call function in my script (See below)

Now, because the Boss’s behavior (and therefore, animations) depend on certain live game-play variables like:

  • Are the Generators all destroyed?
  • Where is the Boss on the screen?
  • How long has the Boss been in that spot?

I can’t just “hard-code” the animations all in the Animator window of Unity, using transitions. I need to actually code a fair bit of the fight using IEnumerators.

So for that, I create a “BossFightManager” script and place it on the Boss (the same object that the Animator component is on).

What the Boss will do during the Generator Phase of the fight

The Animation Events from my animations call these functions, updating variables and starting the behavior code.

Finally, some simple fight maintenance functions for the Lists, which I won’t go into detail about:

The result of all of this:

  1. The Boss will fly downwards, entering the Player’s field of view.
  2. The Boss will then continually fly to the left then right of the screen, pausing and activating its guns, before flying to the opposite side.
  3. This behavior will continue until all of the Generators have been destroyed, at which point, code and animation booleans will be updated, and the Boss will fly up out of the top of the screen. The Boss will then start its behavior for phase 2 of the fight, the Sentry Phase.

I won’t spoil what happens in phase 2, but I will say this: Because I designed the Boss to dynamically spawn its Generators and Sentrys, I can’t independently animate those parts relative to the Boss (because they don’t exist until the game starts).

Therefore, all of the behavior of phase 2 is actually hard-coded. That was an interesting process, and involved a fair bit of maths to get working, but it certainly looks cool and works great!

Check out the game on once I release it (very soon) if you’re curious.

If it’s not here, I haven’t released yet.

It’s currently called Galaxy Conquest, but I’ll probably change that, because its a generic name and there’s something else called that on there)



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
Vincent Taylor

Vincent Taylor


Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.