0 votes

I have made several animations for the Character but only one animation runs. Please download the project and solve my problem.

https://drive.google.com/file/d/1vyPLyTLQmcBIKpiWMJrSVoex9QFxq00M/view?usp=drivesdk

And please please send my email
baszangaraky54@gmail.com

in Engine by (180 points)

1 Answer

+1 vote
Best answer

Hello abbos,

I see your AnimationPlayer has animations for idle, jump, punch, run, speed. Previewing these from within the player, they all work.

However, in the script you use, only two states are actually ever executed.

if is_moving:
    $AnimationPlayer.play("run")
else:
    $AnimationPlayer.play("idle")

The following is a bit better, but the jump is still not that great here as (unlike the others), you don't want to interrupt it.

if $AnimationPlayer.get_current_animation() == "jump":
    return

if gravity == jump:
    $AnimationPlayer.play("jump")
elif is_moving:
    if speed == sprint:
        $AnimationPlayer.play("speed")
    else:
        $AnimationPlayer.play("run")
else:
    $AnimationPlayer.play("idle")
by (392 points)
selected by

thank you my friend

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.