hi guys,
now there's a problem i'm dealing with. i have a health bar of size 100x20 (example)
and i have 3-4 types of enemies with different max HPs. (let's say 100,200,300).
if i want to show their health thorugh that health bar (with keeping the health bar size same) i have to calculate it's scale.
example - 100 = 100 so no need for calcs, 200!=100 so i have to do (example, enemy has 150 hp out of 200 max):
150*100/200 which is 75 and then i show 75/100.
now the problem is here - i need to have a variable MAXHP (200) and variable currentHP (150) to calculate how much is that out of 100pixels. since i know the size of hp bar i don't need that var (100).
this is the question - can i get rid of the 2nd variable (maxhp) and how can i calculate scale then?
(i want to get rid of that var, because every instance then has that var, and i gotta put it by instance because many types of enemy)