+1 vote

When i click my attack button the function calls before animation is done.

in Engine by (392 points)

1 Answer

+4 votes

You can add function calls on the animation.

Like this:
Add new track to the function

Add function call

by (370 points)

I have done that but the function happens on click and is not sync with the animation

And did you moved the "dot" of the corresponding funcion call on the track to the desired timing?
Also, you can add several function calls on the same track at different timings.

https://i.imgur.com/s9lUR4X.png

https://i.imgur.com/s9lUR4X.png

I don't know if this solves your issue, If not, more info would be needed (a pic of your animation area + some description what the function is doing in the code)

im not sure if i put a function in already but i put queue_free() in the name is that how you call a function
Ps:i dont know how to put a picture showing it

I'm not undertstanding your doubt :/
Maybe this tutorial will help :)
http://www.gamefromscratch.com/post/2015/06/07/Godot-Engine-Tutorial-Part-10-Animation.aspx
After the middle of the page there is a part with title "Scripting the AnimationPlayer".
It explains how to use function calls on animations.
(even thought its for an older version of Godot, I think it will be almost the same for current Godot version).

does the function script need to be in the same scene or does it work to instanced scene

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.