Optimizing Parallax in Scene Editor

I need help with parallax in my game. The most common way to do parallax in gdevelop is change the camera position of a parallax layer to something like this:
CameraCenterX(“ParallaxLayer1”) = CameraCenterX(“Base layer”)*0.8

But here’s the problem. As I want to make the layers feel more distant, the initial factor (0.8) needs to decrease as well, for example the third layer could have a factor like (0.5). And this leads to my scene layout becoming really messy if my scene dimensions are quite big.
If I wanted to place a distant object in a correct place (let’s say on X=-4000) in the third parallax layer then in the scene editor I would need to place the object on… correct me if i’m wrong… X=-8000!

I don’t feel like it’s really optimal to create levels or any kind of scenery like this. I would love to hear what you guys think, and I will provide any extra details if necessary.

I’ll give the same answer as I did on the discord:

What you’re describing is how it is done in most engines. But if you are wanting to offset a different layer initially, just modify your expression to include the offset.

(Set Camera center to “(CameraCenterX(“Base Layer”)*0.8)+4000”.), and then just keep your layer layouts normal in the scene editor. Keep in mind you’ll want to inverse the offset since you’re applying a percentage to your position.

1 Like