Quick and simple question. How do I call a node from the main scene to another scene? For other scenes I use the format "export (PackedScene) var tracer_scene = preload("res://Tracer.tscn")" to call the scenes variables so I can spawn in the enemies and such and it works, but this doesn't work when I use this on the other scenes trying to call the main. I have a player object in the main, and I want one of my enemies to follow the player, but I need the player position to do that (which is in the main). I've also tried
"var player_position = $Player.transform.origin" to tru and pull the Player child node of the main and its current position, but it says it's a null instance so I'm still pulling it wrong
#Help with calling main node
3 messages · Page 1 of 1 (latest)
I'm also considering just plopping this object as a child of the main scene instead of its own scene to make this much more straight forward, but I would prefer it to be its own scene
Add the Player to a group and then use something like var player = get_tree().get_nodes_in_group("player")[0] . Then you can use player variable however you want.