0 votes

following this tutorial, 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.

in Engine by (12 points)

2 Answers

+1 vote

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?

by (27,831 points)

thanks a lot!

+1 vote

Hello,
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 :)

by (353 points)

thanks a lot!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.