Can Sprite2 be located on top of Sprite3, without changing nodes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Korsut

Can Sprite2 be located on top of Sprite3, without changing nodes, with this architecture?
Node2D
-Sprite
–Sprite2
-Sprite3

:bust_in_silhouette: Reply From: DDoop

If I’m reading your question right, you want a Sprite graphically on top of another regardless of the order in the scene tree. To do that, set the z-index for the one you want to be on top to be larger than the z-index of the Sprite on the bottom.
All nodes that inherit from Node2D have a z_index property.

:bust_in_silhouette: Reply From: jgodfrey

Sure. Just set the z_index of Sprite2 to a larger value than Sprite3 (either directly in the inspector or through code).