This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I need to make a HPbar dor an NPC.
The ProgressBar is inherited from the control and therefore has no z-index.
I've tried putting the node in a CanvasLayer, but then it doesn't move with the character. The question is whether it can be solved by build-in methods?
(Of course, I can give all nodes a negative z-index, but this is not good)

Godot version 3.5
in Engine by (17 points)

1 Answer

0 votes

I am not sure why you dont want to use the z_index? This is the built in method in godot to decide which layers to draw in which order. By ensuring you put your sprites on appropriate z_index you can decide on the draw order.

by (3,328 points)

ProgressBar haven't z-index and ignore the parent z-index

Okay well I am not sure what you want here, I have progress bars in my games and it always works perfectly you just need to order them above the other sprites. You can literally just make sure the node is lower down the scene tree than the other sprite nodes to order the z_index if that is easier.

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.