I am trying to display a simple HP gauge above the player’s head in the top-view template.
The gauge is displayed, but it is not filled with green by default.
I checked the settings referring to the enemy (slime) gauge in the top-view template and found that the checkbox for “Style and Fill” in the detailed settings was unchecked. However, when I try to check it, nothing happens.
I switched to Godot mode to see if I could check it there, but I received the message: “Resource property switching is disabled. Please use the resource picker to change properties instead.”
What could be causing this?
Also, is it possible to adjust the orientation and position of the percentage number display?
SimpleGauge is built on Godot’s ProgressBar, and the green bar is drawn by the StyleBox in Styles > Fill. I think the slime’s gauge has one and the player’s doesn’t, which could explain why nothing shows even at full HP.
The checkbox not toggling is just how Godot works. Resource properties can’t be turned on with the checkbox, it checks itself once you assign a resource.
The easiest way is probably to copy the slime’s SimpleGauge, paste it onto the player, and point its variable settings at the player’s HP.
To do it by hand, select the player’s gauge in Godot mode, go to Theme Overrides > Styles, click the <empty> slot next to Fill and pick New StyleBoxFlat. Open the new StyleBox and set Bg Color to green and it should show up. Do the same for Background to get the background color.
For the percentage, ProgressBar always draws it in the center, so I don’t think there’s a setting to move it. You can change its color, size and outline under Theme Overrides > Colors, Font Sizes and Constants. To put the number somewhere else, I would turn off Show Percentage and display the number with a separate text. Fill Mode changes which way the bar grows, but the text doesn’t rotate. Rotating the whole node rotates the text with it.
Thank you very much for your detailed explanation!
By following the instructions, I was able to configure the settings without needing to copy anything from the slime side.
However, ideally, even if setting the variables that determine what to reference is unavoidable, it would be more convenient for users if it functioned as a gauge simply by setting the referenced variable.
I understand that this is an inherent limitation due to Godot’s design specifications.