Loading another level
Before we started to animate the light sources in the Let there be flickering lights section, we were ready to move Clara upstairs. To that end, we used a nifty feature of the AnimationPlayer node to fire the load_level
function, which printed a statement to the Output panel, a substitution for the real thing. In this section, we’ll investigate how to swap the existing level with another.
Let us remind you that our current level, Level-01.tscn
, is instanced inside the Game.tscn
scene, which is holding a Camera and an AudioStreamPlayer type of nodes. Godot has a built-in function, change_scene
, that can change the current scene to another scene. However, this might be dangerous since it’ll replace the entire structure. In our case, this is not Level-01.tscn
but everything in Game.tscn
because that’s the main scene.
The solution we’ll offer is a process that’s operational at a higher level than Level-01.tscn
itself. Ideally...