failing to use play_animation

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gm130993

i am doing my first project on godot and using this tutorial https://godottutorials.pro/rpg-godot-tutorial/ and having problems with this part

func manage_animations ():

if vel.x > 0:
    play_animation("MoveRight")

since it says the method " play_animation" isn’t declared in the current class

Check again. I think there are shortcomings

ramazan | 2022-01-27 08:09

:bust_in_silhouette: Reply From: rossunger

play_animation might be a function that you need to write yourself …

the AnimationController has a play() function,

:bust_in_silhouette: Reply From: umma

try this:

onready var animation = $animationplayer

func manage_animations ():
  if vel.x > 0:
    animation.play("MoveRight")