Day 60: Boss Part 2

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!




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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Ultimate Guide to Joining Makers

When I took the movie back to the store, the woman told me the fee: $40! I felt so stupid.

Day 91: Player Lives Part 3.

KUBERNETES: how Kubernetes is used in Industries and what all use cases are solved by Kubernetes?

Putting customers first with SLIs and SLOs

Microservice Flex Patterns

How to Deploy Your Rails App to Heroku

How to create a contact form with MB Frontend Submission

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
Tyler Smallwood

Tyler Smallwood

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

More from Medium

Day 101: Character Animation Part 4

Enemy Script Optimization

Light her up — Adding emissions to your game objects using photoshop and blender

Enable Ads In Unity!