Godot Version
4.5.dev1
Question
i defined a .TSCN whose type is Node2D; when I set on the level it looks like drawn beyond the tiles used for the map:
4.5.dev1
i defined a .TSCN whose type is Node2D; when I set on the level it looks like drawn beyond the tiles used for the map:
The draw order of sibling nodes (nodes with the same parent) is determined by their order in the hierarchy: the first sibling is drawn at the very bottom and the last sibling is drawn at the very top. So to move your scene to the foreground, you would place it after the other nodes in the hierarchy.
although I moved in the hierarchy the node, the problem is still present.following there is a video about it:
That’s because “ElectrizityTrap” is currently the first node in the hierarchy. To be in the foreground, it needs to be the last node.
Hierarchy sorting can be hit-or-miss, you may need to alter the node’s Z index directly.
Z Index is the order in which things are rendered in 2D. When everything is set to the same Z index, scene tree hierarchy is used instead. If you set it higher for a node, that node will be rendered on top of other things regardless of hierarchy position. This can go negative too if you need that.
Z as Relative toggles whether a node’s Z index is based on its parent’s. When this is toggled on, the parent’s Z index is added to the child’s. It’s on by default, toggling it off can be useful if you need something to render independently of its parent.
Y Sort Enabled changes how ordering works entirely. Toggling this on means the node is rendered in front of things with a lower Y position, and below things with a higher Y position. This might useful to add to the player for your game, so they’ll render behind things automatically if they walk behind them, and vice versa.