Course Content
Fighting Game in Unity
Fighting Game in Unity
Controle Your Animation with Script
In Unity, controlling animations with scripts allows you to create dynamic and interactive experiences within your games or applications. This approach enables you to trigger animations, change their playback speed, blend between animations, and respond to various events during runtime.
Controlling Parameters
- animator: This is a reference to an Animator component attached to a GameObject in Unity;
- SetBool(): This is a method provided by the Animator component. It is used to set the value of a Boolean parameter in the Animator Controller, which is responsible for controlling the animations;
- "isRunning": This is the name of the boolean parameter in the Animator Controller;
- true: This is the value that we are setting the "isRunning" parameter to.
Changing Scale
Changing the x scale of our character flips it because scaling negatively along the x-axis mirrors the sprite horizontally. Most 2D sprites face right by default. Flipping the scale reverses this. The character appears to face the opposite direction. This happens due to the way Unity interprets negative scale values, flipping the visual representation of the sprite around its centerline, altering its orientation.
Player with Position X Scale
Player with Negative X Scale
Additional Resources
Everything was clear?