Animations working except one

Godot Version

4.2.2

Hey, I’m trying to implement a few character animations, the specific one I’m having is one called “Rolling” like the metroid ball thing. Anyway, while my Idle and Running animations work fine my rolling one dosen’t. I figure maybe it because the section where the animations code is getting confused but I’m not exactly a great programmer here.

func update_animations(direction, delta):
	if direction != 0 and not is_crouching:
		animated_sprite_2d.flip_h = (direction < 0)
		animated_sprite_2d.play("Running")
	else:
		animated_sprite_2d.play("Idle Animation")

	if is_crouching:
		if direction == 0:
			animated_sprite_2d.play("Duck")
		elif direction != 0:
			animated_sprite_2d.flip_h = (direction < 0)
			animated_sprite_2d.play("Rolling")

	if not is_on_floor():
		if velocity.y < 0:
			animated_sprite_2d.play("Jump")
		else:
			animated_sprite_2d.play("Fall")

	if is_wall_sliding and not is_on_floor():
		animated_sprite_2d.flip_h = (direction > 0)
		animated_sprite_2d.play("WallGrab")

When you say your Rolling one doesn’t work, what do you mean by that?

I would put a print statement before that see if it ever gets there. Also I would comment out all the animation code that follows and see if something in there is affecting the rolling.

Of course you can also use the debugger and single step your code. E.g. Put a breakpoint on your rolling anim and see if it gets there. Then step through it the rest.

Ah sorry, for a more clear result it’s this:

The player character can switch between Standing and Ducking,.
Once a player moves while Ducking they turn into a ball and start rolling.
The character assumes the Ducking Animation but when the player begins to move while ducking, the animation for rolling does not trigger. It instead stays stuck on the “0” frame of the animation for rolling.

My character can stand and run around just fine, the animation for that works, but it does not work for rolling.

When I comment out the Running Animation the Rolling animation works.