Godot Version
4.2.1
Question
I’m currently working on a grid-based top-down 2d game that has elements in the world I can select. So I can move the mouse over and click on items, and then something pops up in the UI when that thing is selected. So I have a sprite like this:
The most straightforward way I can think of to have this sprite follow the mouse (snapping to the grid) and then go onto another sprite is to make it a Node2d
in my scene node in my scene. However, this is a UI element and it feels like it should be in my CanvasLayer
as a Control
nodes. If I do that, however, it seems significantly more work to get it to the correct size and position in the scene, especially if I zoom in or out.
I’ve been having trouble finding other references to how this is most effectively done, but perhaps I’m using the wrong search terms. How “should” I do this? Conceptually it feels like I should use control nodes, but not using them seems easier. I just don’t want to get myself in a pickle later on.