0 votes

my game require many sprites laying on top of each other but is there a way to control which sprite is on top of which and change its visibility layers thx

asked Feb 22 in Engine by kietjay123 (38 points)

1 Answer

0 votes

You can control which sprite is "on top" via its z_index property. Higher values will be drawn on top of lower values...

$Sprite.z_index = 10

Additionally, you can control the visibility of a given sprite its visible property. For example:

$Sprite.visible = false
answered Feb 22 by jgodfrey (6,576 points)
edited Feb 22 by jgodfrey

If I have a Singleton / Autoload and want it to lay on top of my background , what to do , as z-index is not working ?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.