- Home /
Question by
HuskyPanda213 · Feb 12, 2014 at 08:09 PM ·
mathhealth
Make a value inverted/opposite.
I am making a health system where a red screen is based off of a gui alpha value(based off of health), but how do I make it that the alpha value is 0 when health is 100, and so on... Like 75 health = 25 alpha, 40 health = 60 alpha?
Comment
You have answered to this question.
a = 100 - health
That will give you what you want.
But alpha goes from 0 to 1, so maybe divide by 100?
Double-but: straight percents often look wrong. You might code 50% health is 50% alpha, but when people see it, they think they're mostly dead. 50% just looks too faded. So you use ifs or a curve... to make 50% health show 75% alpha (because that looks more like 1/2 for the colors you're using.)
So try it first. Use the Inspector to hand-set alphas to see what look good.