I did something like this recently, and I had a singleton node controlling things, and they had a variable that stored the currently focused Control, and an _input() function that checked if key was down, and then did whatever I needed...
If you add a variable that stores OS.get_system_time_msecs()
, and each input you compare it against the current OS.get_system_time_msecs()
then you can debounce the events and control how fast the repeat rate is.
Alternatively you can use the _physics_process(delta)
event, and use the delta to control the repeat rate... you would still use Input.is_key_pressed()
or Input.is_action_pressed()