Creating Coin Distraction Feature in Unity (Part 5: Adding Throw Animation)

Objective: add the throw animation to the player and trigger it when the player tosses a coin.

First I created a Throw trigger parameter in the player animator.

Then I set the transition between all animations. From any state we can go to throw animation and depending on the value of the walk parameter we activate the walk or the idle animations.

In the player script, when the player make right click to instantiate the coin I added the function _animator.SetTrigger(“Throw”), this function changes the value of the trigger parameter and activates the animation.

And that’s it!!! Now you can see how the player throws the coin.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

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

Recommended from Medium

Example Mapping: 5 tips to avoid forgotten requirements

RESTful Routes

Cara Mengakses Keypad CVAVR

Creating a Roll Player Action in Unity

My Journey of GSSoC’19

How to connect wirelessly to an android device for development

Kite launches Line-of-Code Completions, goes cloudless, and secures $17 million in funding

Developing apps for Android Auto

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
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

Creating Coin Distraction Feature in Unity (Part 1)

2D Mobile: IDamageable Interface

Creating a Simple Cooldown System In Unity

Designing Enemies using Abstract Classes