Call a method in one frame animation player?

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

I need that in a frame an action of a different scene can make, so I know that you can call a method from animation player, but I need that this method return true when the animation player call it, if not it return false, how can I do that?
I am calling the method In an instance of a different scene , so when the frame of animation player call the method, this different scene with the instance can make an action

:bust_in_silhouette: Reply From: rustyStriker

If you bind parameters to the function, you can then specify what will be those variables from the animation player, you can simply have a variable at the end which is defaulted to false and when the animation player calls it just let it pass true with it

 func WantedFunction(var1, var2, var3, isFromAnimationPlayer = false)

but if I do:

instance.WantedFunction() == false:
emit_signal("signal")

it´s always returning false, so the signal isn´t emmited when it reach the frame.

or how I can do in WantedFunction to change the false to true when the animation player frame reach?? sorry I dont know how to do it

Pelli | 2020-04-20 18:36

:bust_in_silhouette: Reply From: Dumuz
  • You can make a ‘Call Method Track’ in the Animationplayer.
  • Create a keyframe on that same track where you want it to call to a
    function in the same scene.
  • Have that (same scene) function call another scene’s function.