Hi peeps, I'm using a formula to change the semi-transparency of a warning icon which appears over your unit as you play, and as your health deteriorates I want it to become more visible (i.e. less transparent).
As you can upgrade your max-health from a wide range 100, 150, 250, 500, 800, 1500 & 2500 I'm using the current formula:
always set alpha-blending of the icon to:
((value(health))*300/maxvalue(health))+value(health)
This does a moderately good job, but I'm looking for an improved formula as there are some flaws:
1 - At low max health settings (i.e. early game), the warning icon comes in a touch too early
2 - At high max health settings (i.e. later game), the icon fades in nicely as you lose health, but doesn't really get very visible until health is literally depleted.
Does anyone have any ideas for a better formula? The alpha-levels are 0-255 (0 being fully visible), which is why I use 300 in my formula (I started with 255, but found that increasing the multiplication a bit helped to change when the fading in started.
Many thanks