0 votes

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?

in Engine by (570 points)

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).

You can have a look at the Minilens demo game to see how it's done: https://github.com/KOBUGE-Games/minilens

Thanks, I'll try messing around :)

1 Answer

+1 vote

A code me and my partner made for godot's jam some time ago has just this...
https://github.com/GameDL8/Mice-A-Ball/blob/master/singletons/GameManager.gd#L37

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...
https://github.com/GameDL8/Mice-A-Ball/blob/master/singletons/GameManager.gd#L150

by (234 points)

Quite useful, thank you for sharing =)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.