hi, i got a question.
how do you use a variable value from another instanced scene ?
i've made a player and a portal instance, then i put a variable with false value at the start of the game that change into true when player press input button which is ENTERkey here. then i make a body enter check on the portal.
the problem is, i want the player to enter the portal when the area collides AND player press the ENTER key button.
basically my code looks like this
on player:
var enter = false
if Input.is_key_pressed(KEY_ENTER):
enter = true:
else:
enter = false
on portal
var areaCheck = false
var doorTrigger = get_parent().get_node("Player").enter
export(String, FILE, "*.tscn") var InsideBuilding
func _on_DoorInside_body_entered(body):
areaCheck = true
func _on_DoorInside_body_exited(body):
areaCheck = false
func _physics_process(delta):
if (areaCheck and doorTrigger):
var bodies = get_overlapping_bodies()
for body in bodies:
if body.name == "Player"
get_tree().change_scene(InsideBuilding)
any help is appreciated