Thisisdcode I think scenes get combined when they are added to the tree, so there just ONE big scene.
if you need the player to detect areas, you have to use something like Area2D
, and when the player enters this area it requests data to this Area2D
that belongs to the scene that spawned with it.
let's say you have a forest scene and a mountains scene, you can put metadata in an Area2D
in each with some text, and then request it with get_meta()
:
first assign metadata to the Area2D
, it's a the bottom of the inspector. let's add a variable "zone"
that is String
and contains the name of the area. In the forest scene this would be "forest"
.
put this Area2D
in it's own layer.
add an Area2D
to the player that collides with this layer, and then connect the area entered
signal
to the script.
when the player enters this area it will trigger the signal and will execute the function. and then you can request metadata from the collided area body
:
var zone = body.get_meta("zone", "default_text")
print(zone)