The method "set_anim" isn't declared in the current class.

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

following [this tutorial] 1, using my own character and animation, but got an error at line 18: set_anim(target_dir)

Error: The method “set_anim” isn’t declared in the current class.

:bust_in_silhouette: Reply From: Zylann

Looking at the video at some point, you can see the user created a set_anim function with tutorial code inside. You get this error because you didn’t create such function. Maybe you made a typo?

thanks a lot!

Ackchually | 2020-04-26 07:10

:bust_in_silhouette: Reply From: Mxt08

Surely as the “set_anim” class will not exist, you should create it yourself.
But you can also declare a variable with the value of the node that contains the animation, and then you should put the name of that variable followed by “.animation =” and the name of the animation, which you want to change (between quotes) or the name of the variable that contains the name of this animation.
I hope it helps you.
Mxt08 :slight_smile:

thanks a lot!

Ackchually | 2020-04-26 07:11