system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
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
system
2
|
|
|
|
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")