detect if entered in area diferent scenes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By arydev

how can i make than if the player touches a door it changes the scene NOTE: the player and the dorr are in diferent scenes

:bust_in_silhouette: Reply From: njamster

the player and the dorr are in diferent scenes

I assume you mean they are both separate scenes. If the are in different scenes the player obviously cannot touch the door, same as I cannot touch you because we’re sitting in different rooms and probably completely different parts of the world.

If your player is a KinematicBody2D (or a RigidBody2D) you only need to connect the body_entered-signal of an Area2D representing your door to a callback:

func _on_Area2D_body_entered(body):

If your player is an Area2D as well, you’d connect area_entered instead.