I want to click-and-drag over multiple buttons, activating each one

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kylekyleton

I have a series of the same kind of control nodes instanced in a row. I want to be able to click on one, hold down the mouse button, drag the cursor over three or four of them, release the mouse button, and have them all activate.

I’ve tried a number of methods, but the issue I keep running into is that the first button I click seems to hold on to the mouse input – in other words, while the mouse button is depressed, gui events are not registered by any other node.

func _ready():
	connect("gui_input", self, "_on_Node_gui_input")

func _on_Node_gui_input(event):
	if event is InputEventMouseButton and event.pressed:
            # this message gets successfully printed
		# clicked control does something

func _on_Node_mouse_entered():
    # doesn't print anything at all while mouse button is pressed down

How can I get around this? What am I doing wrong?


:bust_in_silhouette: Reply From: dancaer69

I’m new in godot and I asked quite the same question before some weeks. I was trying also using buttons, but I didn’t succeed. Maybe it can be done with buttons also(at that time I had very little experience with godot and I didn’t know a lot), but I managed to do it by change them to kinematic bodies(maybe other nodes ase area2d or staticbody2d can word the same).
Here is my question:
Maybe can help you.