@jackhen said:
@TwistedTwigleg said:
Maybe use a VBoxContainer, HBoxContainer, or GridContainer node? Then the Control nodes that are children of that node will be sorted relative to their position in the scene tree relative to their parent.
Im using a vbox container but my problem is i cant change a nodes position in its parent after its been added
I think, though I have not tested, you can use the move_child
function to move a child node's position in the scene tree relative to its parent. It should be something like this:
# get the node's position relative to its parent
var parent_index = get_position_in_parent()
# move the node up one, relative to its parent
get_parent().move_child(this, parent_index - 1)
# move the node down one, relative to its parent
get_parent().move_child(this, parent_index + 1)
That should allow you to change the order of the nodes in the scene tree, which should in turn affect how they are positioned when they are automatically sorted and positioned by the VBoxContainer node.