publish: true
docs: https://docs.godotengine.org/en/stable/tutorials/2d/custom_drawing_in_2d.html#
In this section we'll talk about what is "in front" and what is "behind".
Each subsequent drawing operation inside of _draw() is layered on top of the previous ones. For example:
func _draw():
draw_rect(Rect2(100, 100, 100, 100), Color.RED)
draw_rect(Rect2(100, 100, 100, 100), Color.BLUE)
In this case, the blue rectangle will be drawn on top of the red rectangle, effectively covering it completely.
If you need more control over the drawing order, you can:
_draw() function to achieve the desired layering.