You can mark an input event as "handled" so it doesn't trigger anything else by calling
from within your input function.
This only works if you only ask for unhandled input though (using "_unhandled_input") instead of asking for all input (which "_input" does).
One thing you have to be wary of is that you only call "SceneTree.set_input_as_handled()" whenever you're sure that the mouse is currently over the current Area2D, otherwise the frontmost Area2D object will just eat all input events. An easy way to check this is by using the "mouse_enter" and "mouse_exit" signals.
Here's a script that should do exactly this (Godot 2.1.X using GDScript):
# Whether or not the mouse is currently over this Area2D
var mouse_over = false
# Connect the signals used to detect if the mouse is hovering
over the current Area2D
connect("mouse_enter", self, "_mouse_over", [true])
connect("mouse_exit", self, "_mouse_over", [false])
if mouse_over and event.type == InputEvent.MOUSE_BUTTON
and event.button_index == BUTTON_LEFT and event.pressed:
SceneTree.set_input_as_handled() # Mark the current input
event as "handled"
self.mouse_over = over
For Godot 3.0.0 you have to change _ready and _unhandled_input as follows (also using GDScript):
connect("mouse_entered", self, "_mouse_over", [true])
connect("mouse_exited", self, "_mouse_over", [false])
if mouse_over and event is InputEventMouseButton
and event.button_index == BUTTON_LEFT and event.is_pressed():