0 votes

Hello,

I am attempting to code for touchscreen input; there are two different ways that I am processing input.

I created two different scripts to attach to control nodes; one processes the input in one way, and the other script processes the input in a second way. As an example, a mouse click might print "A" to the output in the script one, and a mouse click might print "B" to the output in script two.

I can get the scripts to work. If I place them in the same scene (on different control nodes), they will both process the input: "A" and "B" will both be printed to the output.

What I wish to do is limit the input processing to one of the two scripts depending on where in the viewport the mouse click occurs.

I have tried, for example, creating two control nodes and set the size to give two rectangles - say each covering half the viewport. However, it doesn't matter in which control node rectangle the mouse is pressed, both will process the input. I can't find a way to limit the input processing to a particular script, with the particular script dictated by the location in the viewport in which the event occurs.

There must be someway to limit which script processes the input determined by the location in the viewport in which the event occurs?

asked Jun 8 in Engine by _func_jay (20 points)

1 Answer

0 votes

Managed to get it working with:

func _gui_input():

Input events propagate up the tree and can be captured by particular control nodes before others if _gui_input() is used.

answered Jun 8 by _func_jay (20 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.