0 votes

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.

in Engine by (28 points)

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

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.

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.

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?

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.

2 Answers

0 votes

I have found your most apparent answer!

Yes, Singletons are a common way to store persistent data!

As well as loading save files.

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.

by (82 points)
+1 vote

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

by (281 points)
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 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 webmaster@godotengine.org with your username.