not the landing i wanted

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

i did the same but for an animated sprite, but when the player land it only show millisecond of the animation and it goes to idle animation
here is the code:

	if is_on_floor():
	if landing:
		get_node("AnimatedSprite").play("land")
		landing = false
else:
	if !landing:
		landing = true

also i tried to do the jumping animation but it only show the first frame
here is the jumping animation code:

	if Input.is_action_pressed("jump"):
	    get_node("AnimatedSprite").play("jump")

you may want to share your code for determining when to go into idle animation. the bug probably lies in that logic

godot_dev_ | 2023-06-12 19:42

:bust_in_silhouette: Reply From: jgodfrey

Posting more complete code would be best (as mentioned above by @godot_dev_). However, such issues can usually be resolved by only playing the default (idle) animation if no other animation is already playing. So, wrap something like this around the code that plays your idle animation…

if !$AnimatedSprite.playing:
    $AnimatedSprite.play("idle")

thanks man it really worked very well!

Mhd08 | 2023-06-13 14:39