• [HELP] Static Healthbar
    4 replies, posted
I'm wanting to have a healthbar that remains the same size no matter the MaxHP, and the current HP will be a percentage of that. Basically, I want the healthbar to stay the same size but be able to display a variety of different MaxHPs, else it would stretch off the screen. I might not be explaining it clearly enough so I made a quick picture to demonstrate what I mean: https://files.facepunch.com/forum/upload/250290/c9334f96-7fd0-4dc1-8ead-7541c9f181dd/maxhpDemonstration.png
Here's hoping that bumping is allowed.
It's simple math: local height = 20 // Bar height local width = 200 // Full bar width local mathh = width*(CurrentHP/MaxHP) surface.DrawTexturedRect(Pos_x, Pos_y, mathh, height)
Use the following function to keep the width at a desired value math.Clamp
knew there was a simple method out there. thank you!
Sorry, you need to Log In to post a reply to this thread.