Topic was automatically imported from the old Question2Answer platform.
Asked By
molni
Hi,
I’m using GODOT3 (newcomer) and know that Z index is using for controlling order of nodes in which they are render on the scene.
But it does not work for me. Tried Z-index, no changes. Tried rearranging layers, but no change…
I have always player on the top layer. Need to setup sprite of parallaxlayer to be above player’s sprite on the scene.
This is probably because ParallaxBackgrounds are also CanvasLayers. CanvasLayers are always drawn completely “in front of” or completely “behind” other CanvasLayers (i.e. z layers are always “within” a canvas layer). I think of it as sort of a separate kind of z layering, if that makes sense.
There’s a default CanvasLayer that your player and walls are being drawn to: layer 0. The two ParallaxBackground objects you have are different canvas layers. CanvasLayers created in the editor default to drawing to layer -1, which explains why they’re always behind the player, even when you’ve set z values differently.
TL,DR: change the Layer property on your ParallaxBackgrounds to get them in front of or behind other layers. I also recommend reading the CanvasLayer docs
Hi Marcopolo,
it is like a wonder, but I managed it to work almost athe same time as I get your email.