Parallax background

Godot Version

4.3

Question

I created a parallax background, and I want that some of its elements goes in front of the player, I have tried changing the parallaxLayer Z ordering to 2 and its children sprite2d, and set my players Z ordering to 1 but the player is still in front of those said elements.

Have you tried to change the CanvasLayer.layer property of the ParallaxBackground node?

i dont have canvasLayer to my parallaxBg, my structure looks like this:

parallaxBg
|_parallaxLayer(bg)
|_sprite2d
|_parallaxLayer(element1)
|_sprite2d
|_parallaxLayer(element2)
|_sprite2d

tried adding a canvasLayer and set it as a parent of parallaxLayer but it gives me an error saying that parallaxLayer node only works when set as a child of a parallaxbackground node.

Every ParallaxBackground is a CanvasLayer, because the class ParallaxBackground is derived from the class CanvasLayer (it inherits all properties).
You will find this property next to other properties on the right side of the editor window.

is it the visibility layer? changed it to 2 for the parallax elements, and 1 for the player but it’s still the same.

  1. Select the ParallaxBackground node.
  2. In the Inspector, change its Layer property from default -100 to 2, like in the following picture.

Then all nodes, that are inside the ParallaxBackground, are displayed above other nodes.

Thank you, it works.

1 Like