I was wondering if it is possible to make it so an action only happens if it is performed in a given location. For example I want an action to be performed on a mouse click but only when the mouse click is in a square, bound by x and y coordinates. Is this possible? How would I do it?
Certainly possible, there are all kinds of ways to achieve it. Here is a very simple example.
if action.released and action_id == hash("touch") then
if action.x > 0 and action.x < 100 and action.y > 0 and action.y < 100 then
--do stuff
end
end
For GUI, I recommend you read up on gui.pick_node().
See this thread to understand the different types of coordinates returned in an input action.
4 Likes
Another approach is to use trigger collision objects and put small collision object at place of mouse click to get trigger_response message.
3 Likes