Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Korinin |
I have a “game board” (TileMap), where chips are moved with mouse, and GUI that overlaps this “game board” sometimes.
I need that if I clicked (or did anything else) while mouse position was above GUI, it wouldn’t interact with “game board” below GUI in that position.
Any ideas?
“The best” solution (which I don’t like but it worked until the last moment) I could invent was to simply ask every GUI node “Is mouse over you?” recursively:
func is_mouse_over():
for child in get_children():
if child.is_mouse_over():
return true
return (get_rect().has_point(get_local_mouse_position())
The problem is, I have to manually attach this script to every single GUI node and manually remove last line in nodes that don’t have Rect2. Apart from this, it looks ugly
Korinin | 2020-08-06 06:44