Topic was automatically imported from the old Question2Answer platform.
Asked By
DodoIta
Old Version
Published before Godot 3 was released.
Hello again!
I’m trying to make a game where I load multiple levels (each level is a scene).
I’ve never done this before, so I thought I could use a dictionary maybe, but I don’t know how to make it work. I’m not quite sure about the syntax too.
Can anyone give me suggestions? Is it a good way to do it/is it viable?
There are plenty of ways to make multi-level games.
You can use get_tree().change_scene() (which will replace the whole current scene by the next one) or have a scene that loads levels as child of itself (so you can re-use parts without having to create singletons).
A code me and my partner made for godot’s jam some time ago has just this…
On it, I simply made an array that held the path to the tscn in the level order I wanted.
Then, when the player managed to finish a level, the function advance_level() would kick in, and do some statistics saving and if the level the player just beat wasn’t the last in this array, it would go to the next one…