I have two toons ones got 600 health the other got 450 health I want to figure out how to do the life bars if I do width= player.life it's too big
if I do width = player.life/5 it's different for both
is there a number that I can divide by that would have the bars visually equal in width regardless of the overall life capacity?
Develop games in your browser. Powerful, performant & highly capable.
You could use a fixed lifebar, it always goes up to 250px max
100% hp = 250px = 600hp = 450hp
current hp / max hp = percentage of 250px
500hp / 600hp = 83%
83% * 250px = 207.5px
100hp / 450hp = 22%
22% * 250px = 55px
For simplicity, lets say you want your life bars to be a max of 100px. If player is 600 HP than 600/100 = 6 so width = player.life/6 and if toon is 450 450/100 = 4.5 so toon.life/4.5
See attached .capx