There’s a button to make it loop, walking animations should be looped. Maybe it would still work if you use while instead of if.
I made a character walk by just playing from idle to walking at keypress, then from walking back to idle.
yes the animation is looped in the player.
The problem here is, I think, that function _process() is called every frame.
So because of that the animation always starts from the beginning, do you
know if there is the way to delay the play of animation until it hits the last
key frame?
The problem here is that you restart the animation at each frame, so you don’t let it run fully, and it likely appears like it’s not working until you stop pressing the button.
You should keep track of the currently playing animation, and only run anim.play() when the animation should change.
Check the platformer 2D demo, DynaDungeons, Minilens (simple ones) or Jetpaca (more complex, search for the new_anim string).