Multiple levels in one scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By scovelme
:warning: Old Version Published before Godot 3 was released.

Okay, so I’m currently working on a 2D top-down game that I want to have multiple areas. First of all, if it’s just a case of moving the viewport when I move between the areas, how would I do that? If there’s an easier way, what is it? This is pretty important to my game, so I’d like to know if there was a way, even if it’s complicated.

Camera2D? By multiple areas you mean “Open-World” or what?

Victor Hernandez Can | 2016-10-04 00:19

I want it so that it either teleports you to the other area or that it moves the view port with the player so that you can just walk there.

scovelme | 2016-10-04 00:25

Okay. I can understand this:
Teleport: You would have to change scenes in order to do this.

Walking there:
-With Transition: you would have to do some kind of transitioning and still would have to change scenes, what would make it look smoothly is the transition.
-Without Transition: Just make a big tilemap lol “Open-World”.

But really, Godot’s scene system makes it so that you would have to change a scene each time you want a new “area”. Unless someone more advanced knows another smoother way.

Victor Hernandez Can | 2016-10-04 00:30

So if I made a new scene for a new area, could I instance in all the objects I want to keep from the old scene and have them use the same scripts?

scovelme | 2016-10-04 00:33

I don’t know how you are working your game, but in my small prototype, im using a Singleton for my character’s consistent data. Health, Item quantity, etc. There might be quite a few other ways. Somewhere i saw how to do this with more than one object by grouping nodes and something else but I don’t remember. Im searching though lol.

Try with a singleton for now, not saying it’s the correct way because I don’t know what kind of game you’re doing. But to instance all your objects to the new scene, i could say yes; by grouping them.

Victor Hernandez Can | 2016-10-04 00:40

:bust_in_silhouette: Reply From: Victor Hernandez Can

I have found your most apparent answer!

Yes, Singletons are a common way to store persistent data!
http://docs.godotengine.org/en/latest/tutorials/step_by_step/singletons_autoload.html

As well as loading save files.
http://docs.godotengine.org/en/latest/tutorials/engine/saving_games.html#some-notes

I have a simple Save System i could share with you if you want. (:

EDIT: This answer doesn’t make a bit of sense, but please read the comments from the OP.

:bust_in_silhouette: Reply From: ludosar

I also wanted to have everything in one scene, and move the camera to change from menu to options to game.

I learned how to do it from Minilens’ source code, and so many other things.

Hope you’ll find you way