Day 60: Boss Part 2

Tyler Smallwood
3 min readJul 18, 2021

--

Objective: Give the boss different movements.

To use the movement state from yesterdays article I created different animation for each movement.

While the boss is in a calm state, the movement function will decide if the boss moves left or right by calling a SetTrigger(“TriggerName”);. Same goes for when moving into rage mode we set a bool to true. I got a trigger for each move and the laser.

In each animation I added events to change the state of the boss and reset the trigger to keep it from looping.

Each even that is saved is a function that I created in the boss script. To set the state from the animator we need a function that takes in a enum to set the state. If the state lands on Attacking we will set canFire to true to allow it to fire. If it is not attacking it’ll stop the Coroutines that are firing.

We have a function to set the boss to invincible and vulnerable. These functions just set the bool to true or false depending on what was selected in the event.

The last one we have is to reset the triggers. Since we call a trigger to select the movement we need to reset it or the animation will start again due to the trigger still being set. Since there are multiple different triggers that will need to be reset we will run though each animation parameter type that is equal to trigger and reset it.

That is how we move the boss around depending on which trigger is called. Tomorrow we will talk about the new Laser attack the boss has.

Thank you for reading! Have a wonderful day!

--

--

Tyler Smallwood
Tyler Smallwood

Written by Tyler Smallwood

I am passonate on learning to program and use Unity to become a skillful Unity Developer

No responses yet