Parallax backgrounds move when jumping

Godot Version

4.2.1

Question

I have implemented many parallax backgrounds with many parallax layers and they are working as expected, the only issue is when the player jumps the the layers move with him to the up or down,

the question is, how can i lock their y position in relative to the view port? (if my terminology here is correct)

Just script it so the background object moves up and down when the camera moves up and down.

there isn’t a cleaner way that make use of predefined attributes on the level of parallaxbackground or parallaxlayer objects?

I don’t think so. Parallax is usually on both dimensions, so what you want might be out of scope of the implementation, but I wouldn’t say it’s not clean to move the background with the camera. That’s what parallax is anyway, just with a different factor per layer.

If you don’t want your parallax layers to move vertically set the ParallaxLayer.motion_scale.y to 0

even with sitting it 0 it still follows the player

Everyone here thought this is what you wanted!
Apparently you want it to match the tilemap layer.
Script it so you subtract the camera position from the background position.

1 Like