Accesing variable from another scene
i was trying to make a door/portal sort of which can bring the player to another scene on input.
so i make a variable called 'enter' which return false and change into true upon player input (on this case, i set it on enter key)
then i made a door scene with area2d and put a body collision as a trigger to transport the player, and it works as well.
the problem is i cannot access the enter variable on player scene, because i want the player to enter door area detection and use an input to transport them into another scene.
Here's the code i used on the door scene:
#Transfer To Inside Building extends Area2D var Play = false var DoorTrigger = get_parent().get_node("Player").enter export(String, FILE, "*.tscn") var InsideBuilding func _on_DoorInside_body_entered(body): Play = true func _on_DoorInside_body_exited(body): Play = false func _physics_process(delta): if (Play and DoorTrigger): var bodies = get_overlapping_bodies() for body in bodies: if body.name == "Player": get_tree().change_scene(InsideBuilding)
and it return a Null Instance error