thoth
02-17-2012, 04:11 AM
Okay, so I'm going to try to word this the best way I can and have it make sense where I'm stuck.
What I need is to make a configurable const for a location on an hp bar in %.
http://i.imgur.com/cJ1LI.png
that's the hp bar.
The full side of the hp bar is 524,175 the empty side is 408,175
what I need is basically, if there's a const like "percenttochicken = 50;" it well tell a function to calculate the coord at 50% of the distance between hp full and empty and return that x,y
So I guess I'd need to craft a function kind of like
function hppos(hppercent:integer):integer;
begin
(whateve math I can't figure out)
end;
I've been trying to wrap my head around it for a while now, and I really just can't seem to pull anything out my ass, so any help would really be appreciated.
edit:
so I was thinking about it some more, so logically it could go fullhp-emptyhp then with that number apply the percent to it, then add that result to emptyhp to spit out the result percent, but again, not sure at all how I would do this
edit2:
How can I turn an extended variable into an integer, like at the end of a function I have x = 70 but it's still extended, how can I turn x into an integer
I found a ghetto work around to this, I made it a string then I converted the string into an integer, it works but I was wondering if there's a direct way.
What I need is to make a configurable const for a location on an hp bar in %.
http://i.imgur.com/cJ1LI.png
that's the hp bar.
The full side of the hp bar is 524,175 the empty side is 408,175
what I need is basically, if there's a const like "percenttochicken = 50;" it well tell a function to calculate the coord at 50% of the distance between hp full and empty and return that x,y
So I guess I'd need to craft a function kind of like
function hppos(hppercent:integer):integer;
begin
(whateve math I can't figure out)
end;
I've been trying to wrap my head around it for a while now, and I really just can't seem to pull anything out my ass, so any help would really be appreciated.
edit:
so I was thinking about it some more, so logically it could go fullhp-emptyhp then with that number apply the percent to it, then add that result to emptyhp to spit out the result percent, but again, not sure at all how I would do this
edit2:
How can I turn an extended variable into an integer, like at the end of a function I have x = 70 but it's still extended, how can I turn x into an integer
I found a ghetto work around to this, I made it a string then I converted the string into an integer, it works but I was wondering if there's a direct way.