Input
is a singleton, and it's unrelated to the _input
callback. _input
is fired every time there's any input, including mouse movement, keyboard presses, gamepad joysticks, and so forth; in your code, every time this happens, the Input
singleton is asked to see if a specific action is down, and so long as the player is holding down that action, it will return true, thus, it fires even when other input is detected.
You would want to use Input
in, for example, _process
, for continuous action detection; otherwise you would follow the advice above, to use _input
's provided event
variable to check for input only when it happens; event
is particular to the specific kind of input that occurred, e.g. if you didn't press "move_right" that moment, event
will just report false if you ask for it.
"Hey event
, are you this action?" "Noooo, try again!"
vs.
"Hey Input
, can you check this action for me?" "Sure thing boss!"