How to put sprite in front or behind another sprite

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

Making a skeleton for my character it made up of parts

:bust_in_silhouette: Reply From: 2D

Checkout the cutout animation tutorial located here. You can set z-property, or move in tree and use remote transform.

:bust_in_silhouette: Reply From: Footurist

Well, there are two things to consider:

Most nodes, that you work with in Godot inherit Node2D or Control, which both inherit CanvasItem. This node has has a property z_index, which defines the position in the z axis, or in the depth of the canvas if you will. So this

Node 1 - z_index 1
Node 2 - z_index 0

will lead to Node2 being drawn above Node1, although the order in the scene tree is the opposite. However, it’s best to use these only when necessary, because by default, nodes will be drawn the order you put them in the scene tree.

:bust_in_silhouette: Reply From: JeanMakeGames

Hi there,

Dunno if it is what you are looking for, but in godot 3.1 you have in canvasItem a category called visibility. there you can chose the order of your sprite. here’s a short video of it :slight_smile:

How to put a sprite in front of an other sprite