Hello
Currently I am working on a top-down 2D game where the player explores a randomly generated dungeon. When the dungeon is generated, each room is a premade scene with set entrances and based on the layout generated, the program will go to each room in the generated layout and place a premade room with the same 'links' (doors or tunnels).
I use gdscript by the way.
Instead of instancing each room in one big scene, I would like the whole scene to change to the room scene based on which room the player is in.
Currently all rooms are in 1 big scene with stand-in rooms and the camera changes to a camera fixed on the room the player is in for prototyping. If you imagine the Binding of Isaac with the rooms being blank with a white outline then that is exactly what it looks like right now.
The program DOES save what room is adjacent to it in a dictionary (replacing null if there is a room and staying null if there isn't a room) like below:
var connectedRooms = {
Vector2(1, 0): null,
Vector2(-1, 0): null,
Vector2(0, 1): null,
Vector2(0, -1): null,
}
I just don't know how to change scene as I cannot write 'change scene to this path when enter here' as the path I want the scene to change to technically hasn't been made yet.
I was wondering if maybe I put something like 'if enter this area (the exit) change scene to this room in dictionary' but I don't know exactly what code to put in.
I'm also worried that if I do do 'if enter this area (the exit) change scene to this room in dictionary' then I don't want the character to be entering the same scene when it is actually two different rooms using the same room layout so would I have to do something with .duplicate()?
Thanks in advance.