Nerd For Tech
Published in

Nerd For Tech

Using Animation Events

Now that we have the skeleton set up, let’s take a look at how we can have it so that our Spider enemy has it’s own unique methods. For this game, our spider will just sit idle in the back corner and fire off acid balls. In order to do this, we will want to go into our Spider script and remove the movement functionality, along with create a new event within the attack animation of the spider.
To do this, we are just going to create an override method within the spider script and do away with the movement:

After taking away the transition within our animator, we can see if it just sits in it’s corner:

From here, we are going to get our script set up for when our spider attacks, and after setting up the animation event within the dope sheet, we can test it out within the game:

Next, lets work on instantiating our acid balls to fire from the spider. We will need to create a couple new scripts for the attack to be used and have it linked to our spider script:

Once we get it all set up, we can test within our game to make sure that the acid balls interact with the player as well as destroy themselves after a 5 second period of time:

There we have it, we have set up our spider’s unique attack through the use of animation events. Next, we are going to explore how to create a loot system within our game.

--

--

--

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Recommended from Medium

It’s time to tidy up your code: How to use Visual Studio Code Autoformat

How to Sign In to your AWS Educate Account?

Powerful Ruby Struct

Introducing Pangea: Security Services and APIs for App Builders

HMS Account Kit and Features

Spark Optimisation Checklist

A plea for lean software: 6 Lessons I learned to help keep software simple

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
Jordan Evans

Jordan Evans

More from Medium

Using the Unity Profiler

Journal 146 — Unity Project Development, 2.5D Shooter

Daily Progression: Generate a Case Number!

Building A Stealth Game — Helping Your Guards “See”