#How do I get a method to subscribe/listen to an InputEvent? GDScript

3 messages · Page 1 of 1 (latest)

dry ether
#

How do I subscribe to an InputEvent so that I can have a method that fires only when the input is sent?

vital halo
#

you probably have to do this yourself. a signal pretty much is just a list of callables you all call on when it's triggered.
my approach would be to have an Autoload which holds an Dictionary. each key is the string you use to identify the input event. The value is a list of Callables that listen to the input event. Then in the _input_event() of the Autoload you loop through the keys and check if one of them is pressed. If it does you loop through the list of Callables and call each of them.

dry ether