Page 1 of 1

RPG HEALTH BAR PLZ HELP!

PostPosted: Mon Mar 22, 2010 12:55 am
by xinfinite33
well im making an rpg game where you can increase your variable stats as the game progresses like maxhealth and etc. but i made a healthbar that has 20 frames from 0"empty to 20 "completely full"
the problem is that when i increase the maximum health more than 20 it gets complicated because i dont know the right "formula" for calculating percentages and converting them into frames. i saw the other healthbar examples but they were either not what i was looking for, or too complicated so please... a little help? :(

Re: RPG HEALTH BAR PLZ HELP!

PostPosted: Mon Mar 22, 2010 5:20 am
by skydereign
It would be like this, though if the HP is too low, it will round to zero. This would be easy enough to fix, but you may or may not want to keep it, if you need help with that just ask. frames is the max animpos of your health bar.
Code: Select all
animpos = round(HP/maxHP*frames);

Re: RPG HEALTH BAR PLZ HELP!

PostPosted: Tue Mar 23, 2010 2:41 am
by xinfinite33
thank you. works like a charm. i appreciate it :D