# Health bar percentage

Hey, I’ve created a game HUD with a health/ energy bar etc, with the max health value set as 1 (which is a full bar) but due to adding a lot of maths to the health bar since e.g. enemies and fall damage, I think I’ll find it easier if the health bar max value was set as 100% rather than just 1, so would this be difficult to change? Thanks

i dont even understand what are u asking, but
current / max = from 0 to 1
current / max * 100 = from 0 to 100
so if for some reason you use percentages in format 0 100 you can just divide it by 100 before setting up progress bar.

Health is set as 0.5, where I want it to be a value of 50 for 50% not 0.5

why?
you set that manually anyway, via set percentage, so just divide by 100 right before set percentage.

The percentage will ALWAYS be from 0 to 1. You can only do the math to calculate your big numbers down to a range from 0 to 1.
The normal way is to divide your CurrentHealth by the MaxHealth.

For example CurrentHealth = 50, MaxHealth = 100 -> 50/100 = 0.5
Other example CurrentHealth = 120, MaxHealth = 200 -> 120/200 = 0.6

And so on. What exactly CurrentHealth and MaxHealth are, depends on you.

Fall Damage etc is applied to the CurrentHealth. So if you have CurrentHealth = 120 and MaxHealth = 200 and you fall too far and get 20 damage,
you will end up with Currenthealth = 100 and MaxHealth still = 200. So you have 100/200 = 0.5.

That’s how it works and that’s how it needs to be done. You can’t change the way the PercentageBar fills with 0 to 1.

1 Like