I have a "turn tracker", a list of icons representing all the units in play and their turn order. I want to allow the player to change the order by clicking on the icon of a friedly unit, and dragging it in another position in the queue, with some restrictions. However, I want the turn-tracker to update in real time:
* When you click and drag an icon across the tracker, its position updates accordingly.
* When you release the icon into a valid position, the change becomes permanent
* Releasing outside the tracker or right-clicking discards any changes.
My tree looks like this:
- HBoxContainer (Container for all unit icons)
- PanelContainer (Unit)
- TextureRect (Unit icon)
- Other UI elements: name Label, health bar, etc
- PanelContainer (Unit)
- PanelContainer (Unit)
- PanelContainer (Unit)
I'm aware of the built-in drag and drap functions (getdragdata, candragdata, drop_data) but I'm unsure how to implement the logic.