Call function right before _input?

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

I need to call a function right before the _input function gets called. Is this possible?

Maybe you can override _input in extended class?

decepticlown | 2021-09-27 09:26

just call sharingan()

Andrea | 2021-09-27 13:24

What exactly are you trying to do?

timothybrentwood | 2021-09-27 20:34

you can add the function on the first line inside the _input() function, i dunno what you are trying to do but also you can yield or pause until the function finish

Whalesstate | 2021-09-27 21:04

:bust_in_silhouette: Reply From: Lola

what do you mean by “just before”? How putting your code/function call at the beginning of the _input definition does not do what you want?

Input events gets propagated from bottom to top of the tree meaning nodes lower in the tree get to handle the input first.
So if you want to have a global pre-access to input events you can add a node to the root and raise it to ensure it’s the first whose _input callback is triggered.

I needed to call a function before input because I needed to make my character walk, and for that I had to set velocity to zero before processing input, in order to make the character stop when there is no input. Anyways I solved it by setting a flag for when there has been input, and then processing it later in the code.

JorensM | 2021-09-28 08:31