My card game has a board made from control nodes, as it is much easier for positioning and whatnot. However, now I’ve run into the issue that I don’t know how to reparent the entities that are supposed to be on the game board to the containers its made of.
Like how do I tell an enemy to “move” to a position on the board (move to another container in the board scene) if the board isn’t global? How do I send an entity to a specific container that’s the child of another container?
by reference to the board’s root node, are you referring to a preloaded cont?
like const COMBAT_PANEL = preload("res://combat_panel.tscn")?
Or is this something else? I can’t figure out how I would use @export to get a reference to the root node
What ever is creating the enemies must know about the board somehow, it’s difficult to say without a more context of how the enemies are created and where the combat panel exists relative to that.
My enemies are created by a global scene. So if I create a reference to the combat board in the global scene would that work? How would I make a reference to a node from a different scene and put it in my global scene?
The combat panel exists in a different part of the tree than the Global scene.
I think get_tree().current_scene should give you the root node of your combat board (if that is the main scene you are running), even when called from a global scene.
By default the scene set as main scene in the editor, the one you are starting. If you use functions like get_tree().change_scene_to_packed(), that changes your main scene.