mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Player Animation based on speed
This commit is contained in:
parent
ea1f50d249
commit
29bf869bd1
1 changed files with 10 additions and 2 deletions
|
|
@ -56,13 +56,21 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
|
||||
public void SetAnimation(Vector2 velocity)
|
||||
{
|
||||
if (velocity.X == 0 && velocity.Y == 0)
|
||||
if (velocity.Length() == 0)
|
||||
{
|
||||
_animatedSprite.SpeedScale = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_animatedSprite.SpeedScale = 1;
|
||||
if (velocity.Length() > 40)
|
||||
{
|
||||
_animatedSprite.SpeedScale = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_animatedSprite.SpeedScale = 0.8f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (velocity.X > 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue