Hey, I seem not to be able to grasp the idea of InputEvents propagation in Godot. I have prepared an example project to show you the problem I'm having.

So I have pointing/emulate_touch_from_mouse=true
set in my project as I'd like to be able to deploy to mobile but test on the PC.
I have a set of shapes - squares in this instance - that are all Area2Ds. Whenever I click any of them I need it to disappear and send a signal that it's gone. Here's the code I'm using
func _input_event(viewport, event, shape_idx):
if event is InputEventScreenTouch and event.is_pressed():
print("_input_event(...)");
queue_free()
emit_signal("square_destroyed")
get_tree().set_input_as_handled()
The problem is that whenever the squares overlap each other one InputEvent propagates to all of them (checked in the debugger that it's in fact the same event), despite the get_tree().set_input_as_handled()
line at the end. Do I really need to create a cooldown timer for such functionality?
I tried defining an action in the input map, and using event.is_action_released(...)
, but then none of the squares get destroyed.
Thanks in advance.