Hi,
you can put checkCatch() function inside _unhandled_input(event): instead of in _input(event). That way only will arrive to the game the inputs that are not handled by gui.
Thank you for your answers.
_unhandled_input(event) works fine for my issue.
I could also use a boolean variable 'gameStarted ’ with my action_pressed event that would prevent checkCatch() to be executed as long as the game is not started.
func _input(event):
if event.is_action_pressed("click") and gameStarted:
checkCatch()
franco73 | 2019-01-08 23:11
Yes, you could also do that! I think that is better idea to use _unhandled_input always that you mix gui and gameplay and ui in the same scenes, as this would let you have as many controls you want without any change to code. Maybe now there is only one button and adding just one variable is not an issue, but perhaps later one you want to add other controls that sould also work when game already started without triggering gameplay effects. I dont know if im exolaining myself.
p7f | 2019-01-08 23:22
ok this sounds more efficient. I’ll stick to _unhandled_input.
Thanks again.
franco73 | 2019-01-09 10:17
You are welcome! If the answer solved your issue, then you may select it so others can see it’s solved