Changing the Camera coordinates makes object instances in layers invisible?

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!

I think the confusion is because there isn’t only a single camera. Cameras are unique per layer.

If you have 5 layers, you have 5 cameras. If you’re wanting to keep their view in sync, you have to move the camera for all 5 layers (meaning a camera event for each layer). This is also how parallax movement works (one of the parallax layer cameras moves by only a fraction of the base layer’s camera movement)


Thanks. Tried it out and switching all 8 cameras to the new coordinates worked just as I wanted it to. That takes care of that issue. Any suggestions on building each room for the game into its own scene. Would it be better to have them in scenes and just share the assets I’m using as global objects rather than keeping it all as a big canvas of stuff the camera just hops around in?

“better” from an engine sense? No huge change, since graphics that are offscreen aren’t rendered by the engine.

“better” in general? It depends on what is easier for you.

1 Like

Alright. Thanks for the replies. Much appreciated!