Hey all, I have an issue with the presence of a subviewport within my game.
Within the subviewport, I have a click and drag feature that move around the content of the subviewport. Issue is, whenever some clickable content gets out of the viewport underneath the ui around it, it still clicks the on the elements of the subviewport as if they were visible. In other words, i'm trying to make anything that gets out of the range of visibility of the subviewport non-interactive.
I'm trying to figure out a solution. My idea, so far, is to make a area2d that detects the presence of the mouse on subviewport. I would work, except I can't seem to find a way to programmatically make the area2d scale with the viewport (since the viewport size depends on screen size). I don't even see the area2d when I enable the debug visible collision shape. Here's the code for it:
func _ready():
game_data = GameData.new()
game_data.init()
money_lbl.text = "Money: " + str(money)
mouse_area_viewport.position = main_game_container.position
var new_shape = RectangleShape2D.new()
new_shape.size = main_game_container.size
print(new_shape.size)
mouse_area_viewport.shape = new_shape
_generate_new_maps()
Anyone can help?