So far all my GDevelop projects have been made in just one layer and an optional HUD layer for… well HUD stuff so the camera has never been an issue, but now I’ve dabbled into more layers than just the HUD layer and it’s messing everything up. I’ve been trying to find out solutions/explanations on how the camera actually works, but I’ve come up empty. Let me explain what I’m doing first.
I have a game world which consists of different “rooms.” The rooms exist in the same scene, but are spaced and scattered all over the working area and outside the default camera view. When the player walks to a room exit they are transported to another room, into its entry point, and the camera should follow suite, kind of like in the old Prince of Persia games. Basically you walk to the edge of room 1 and then the camera switches to look at room 2 instead and the player is moved to the corresponding position in that room. I kind of suck at explaining what I’m trying to do here. The camera never follows the player, but it focues on rooms instead.
Now the problem I’m running into is that it kind of works the way I want when there’s only one layer, but as soon as I start separating stuff onto different layers everything goes weird and all the object instances in different layers are not displayed properly. I’m not sure I understand how the camera actually works. One would think it would be enough to just to give the camera some new X and Y coordinates and that’s it, but that seems to be not how it works when it comes to having more than the “base layer” GDevelop has by default.
All the objects in the game world that I’ve created are in several layers. There’s the “Background” layer for background stuff, ground, walls etc. “Items” layer for items the player can interact with. There’s a layer for “collision objects” which prevent the player from walking through walls and such and a few more layers for the player character and enemies and so on. There are 8 layers in total in the works here. Everything works just fine unless I touch the camera coordinates. None of these layers seem to work properly when I move the camera from its default position.
The simplest answer to my problem would probably be creating the game world by putting each room into its own scene, but then I have to do so much more extra work building everything up again. I don’t think performance is an issue by staying in one scene alone since GDevelop doesn’t render objects outside the camera space, or that’s how I’ve understood it anyway.
I guess my question is more along the lines of :
“What’s up with the camera and why aren’t the layers working and showing up properly after I change the camera’s X and Y coordinates? I don’t want the camera to follow the player, but follow the rooms.”
“Would it be better to build the game in such a way, that each room the player goes to would be its own scene instead of having the entire world in one scene and having the camera just focusing in on the room where the player is currently in, like the game is being built right now.”
Any help is appreciated. Thanks!