Ulysses
General => Developers Corner => Topic started by: DankNessProvides on April 25, 2016, 03:57:46 PM
-
What I am doing is making my own star wars HUD but I want to have the health bar so it changes size when it is at higher health than 100 so it would use the job health and would change size when they are at 110 health but their starting health was 175. I don't know what to do to make it adjust with the health when they are higher than 100 health.
-
Without knowing what you're currently doing to display the health it's going to be pretty hard for us to help you.
I can only suggest using (http://wiki.garrysmod.com/favicon.ico) Entity:GetMaxHealth (http://wiki.garrysmod.com/page/Entity/GetMaxHealth) somewhere in your math to set the width of the health bar.
If you could post a snippet of code pertinent to drawing your health bar then I would be able to assist you more.
-
-- Health Bar
draw.RoundedBox(2, ScrW() - ScrW() + 30, ScrH() - 70, 380, 40, Color(0,0,0,175))
draw.RoundedBox(2, ScrW() - ScrW() + 32, ScrH() - 68, (376) * DrawHealth / 100, 36, Color(255,45,45,100))
draw.SimpleText(EchoHealth, "DermaLarge", ScrW() - ScrW() + 210, ScrH() - 65, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
Sorry did this late at night trying to fix some other issues forgot to add the snippet of code.
-
You have what seems to be a variable ('DrawHealth') that isn't defined in that snippet. Can you show us the declaration for that variable as well?