How do I reapeat once per loop?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Prestidigitator
:warning: Old Version Published before Godot 3 was released.

So I’m working on a platformer game, with the animated sprite node in Godot 2.1. And I have it like so:

(Not actual code)

func fixed_process ():
  If right key pressed:
    Set animation to walking

Problem is that it sets the animation to itself so many times it doesn’t actually loop.

Please help!

:bust_in_silhouette: Reply From: volzhs
var anim_state = "idle"

func fixed_process():
    if right key pressed and anim_state != "walking":
        Set animation to walking
        anim_state = "walking"