0 votes

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

in Engine by (12 points)

1 Answer

0 votes

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):
    get_tree().change_scene("<PathToNextScene>")

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

by (10,221 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.