Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Player Animations | Player Behavior
Fighting Game in Unity
course content

Course Content

Fighting Game in Unity

Fighting Game in Unity

1. Unity Animation System
2. Player Behavior
3. Enemy Behavior
4. Improve the Game
5. Improve the Flappy Bird Game

book
Player Animations

Attack Type

To inform our animator of the desired attack, we need to create different attack types and assign each type an integer value. For the first ability, the attack type will be 0 and for the second ability, it will be 1.

Control the Attack Type with Script

The code handles attack states by setting different attackType values and updating the isAttacking parameter based on mouse button presses and releases, allowing for distinct attack actions and their termination.

Overall, this code handles attacks in a game, distinguishing between left and right mouse button presses and releases. It sets the attack type since every button will have a different attack, and updates animator parameters accordingly. When either button is released, it stops the attack animation.

What is the purpose of the `attackType` parameter in the code that we did?

What is the purpose of the attackType parameter in the code that we did?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 2
We're sorry to hear that something went wrong. What happened?
some-alt