# AS3 - Increase tint as health decreases

I'm working on a game where enemies continually spawn with more and more health based on how long you've been playing. As the enemies take damage, I'd like their sprite to get darker and darker, until they die.

Here's what I've got so far:

    enemy_array[i].health -= damage;
healthcolor.setTint(0x000000, enemy_array[i].health*0.1);
enemy_array[i].transform.colorTransform = healthcolor;


Predictably, this is making enemies get less black as they take damage. What I need is to convert the decreasing enemies' health into an increasing number between 0 and 1.

I have absolutely no idea where to begin. It's entirely possible I have tunnel vision, but I'm hoping someone here might have an idea for how to accomplish this.

Thanks for your time.

Healthratio = currentHealth/MaxHealth