How to call function on a certain frame in animation player

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

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

:bust_in_silhouette: Reply From: cardoso

You can add function calls on the animation.

Like this:
Add new track to the function

Add function call

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

Newby | 2017-10-13 04:10

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)

cardoso | 2017-10-13 10:08

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

Newby | 2017-10-14 11:08

I’m not undertstanding your doubt :confused:
Maybe this tutorial will help :slight_smile:
Godot Engine Tutorial Part 10-Animation – GameFromScratch.com
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).

cardoso | 2017-10-14 22:50

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

Newby | 2017-10-15 05:07