Delete all nodes we used for testing
How does Main know which level to load?
To keep track of data that needs to move between scenes use an Autoload Global Singleton
This is a script or scene which the Godot Engine will automatically load at all times.
Even if you change scenes, the autoload will remain and is globally present and always available.
Right-click in the FileSystem and select
Create New => Script
Save the script as game_state.gd
Add variables to store paths to
Note that num_levels should be set to the number of however many levels you have created.
Ensure the level scenes are saved consistently as level_01.tscn or level_02.tscn and so on.
Add it as a Global by going to:
Project => Project Settings => Globals
Now return to the Main Scene
Whenever the main scene is loaded
Corresponding level scene
Return to the Title Scene
Add a function to load the next level
Return to the Base Level Scene
Create a function to restart the level
Remember to Connect the signal
In Project => Project Settings => Run
Set Title Screen as the Main Scene
Play test the game - confirm that everything works as expected.