Topic was automatically imported from the old Question2Answer platform.
Asked By
WimpyBaby
Quite new to godot and Im trying to learn how to program basic movement in a 2D platformer with animated sprites. The animations for moving left, moving right and idle:ing all function without problems. I think that the animation is indeed playing but keeps getting replayed constantly which freezes the frame.
I think your problem is you are running the animation every time you put in an input. So it restarts every time it registers a keypress. Below is an example where there is a separate function for the animation, now the animation is separated from the input so it should work based on the motion instead.
so the custom function check_controls() can contain the lines, that it replaces here.
and it looks like in this situation it´s not needed to pass motion to the animations-function, because it´s declared above all functions (it´s not declared inside process here) and can directly be used inside the animations-function