Don't know if this is a bug, but I'm in the middle of trying to update my project from Godot 4.0 to 4.1 and I can't tell what's wrong with this. When my game starts, the character is in the idle animation. Then, when you press WASD to move, it goes into the moving animation, but then when you let go, it stays in that animation. My code was working fine in 4.0, but it doesn't work anymore.

I tried "printf debugging" by putting prints after both parts of those if statements, but those show up as expected. Something interesting is that if I go to my Run animations and set them all to be NOT looped, the problem goes away, but then the running loop cycle only plays once while you hold down WASD and then your character just slides on the ground with no animation until you let go and start moving again.

Did they break AnimationTrees, or is there just a new way of doing this?

hmmmm......... i been working on this for over an hour now, trying to figure out a way around it without success.
but i can at least confirm the strange behavior in ver4.1.1:

	print("0")
	
	if moving:
		print(moving)
		anim_state.travel("Run")
	
	if !moving:
		print(moving)
		anim_state.travel("Idle")

that code i put in should have been a good work around because when you hold down you see TRUE and when you let go you see FALSE and both are mutually exclusive in the char.gd code.

therefore the desired effect should happen but doesnt... looks to me like it something to do with the animation system not recognizing the change in animation as desired....

i'll try seeing if there a way around it in code a bit longer but i tried lots of different ways of doing it with no success...

i found it!! --- err, i think.....

try this:

goto: AnimationPlayer for AgentE and look at the animations. the Idle animation is named "STOP" in all caps.

in char.gd this works -- i think...

	print("moving==["+str(moving)+"]")
	
	if moving:
		print("run    true=="+str(moving))
		anim_state.travel("Run")
	else:
		print("idle   false=="+str(moving))
		#####anim_state.travel("Idle")
		anim_state.travel("STOP")

    i've been thinking about it. it might be that the last GoDot version had a default to the [0] element in the animation list if no match was found. Then maybe that changed to just not change the current animation 'unless' a match is found...

    Maybe there could be a setting added for "Default animation" that would be [0] or "Don't Change animation if no match found"

    idk if that would be useful but it an idea.

    11 days later

    ucmRich Just randomly remembered to come back to this thread rn... I was busy with something else back when I saw your post and didn't really get to test it much, but I remember there wasn't a "STOP" animation... Can you show how you found it?

    I found it i the properties section on the right side of the editor...

    Click the AmimationPlayer under AgentE or the others and then the right side brings up properties for the AnimationPlayer and it has a property for "Current Animation"

    click on that and that's where i found it 🙂

    last week when i was on it had STOP in all caps but now it's lowercase when i reimported your project but i think it might be GoDot or something i did somehow... possibly Case doesnt matter when selecting an animation from the animation list.

    15 days later

    ucmRich Changing the "STOP" to anything else still makes the animation stop... I think the issues might be the opposite of what you said in the next comment... Maybe the AnimationTree is NOT finding anything named "STOP" and just stopping the animations. When I set it to Idle, it seems to just keep playing the run anim. Very strange.

    I'm just gonna change the Run -> Idle one to "immediate" for now and prob come back later... Probably spent like 80% of my time on this one minor detail instead of working on the rest of the game. ;-;