AnimationPlayer animations is not run

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By abbos

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

:bust_in_silhouette: Reply From: Tim Martin

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")

thank you my friend

abbos | 2020-09-14 05:51