AS: Linear Increasment 2005-06-28 14:04:56
let's say you have a lifebar, whose max width is 300 and it's min width is 30, now you want that life bar's width to be equal to the right amount each time of life, your problam is, life goes between 10 and 37 :P
This is how it's done:
so basically you have 2 min values, 30 and 10, that's your first 'point.'
you also have 2 max values, 300 and 37, that's your second 'point'
in math, there is only 1 streight line between two points, our points are (10,30) and (37,300), remmember the first value is the variable (life) and the second variable is the function (the stuff you want to change according to the first value)
you can find the angle of a line with this formula (y2-y1)/(x2-x1), in our case (300-30)/(37-10),
this is 270/27, which is 10 ;) so we now know that we must increase the width by 10 for every hp.
now let's make this into a formula
remmember adding a check for hp>10, otherwise you're off limit
hope I helped, post questions