RPG HEALTH BAR PLZ HELP!

You must understand the Game Editor concepts, before post here.

RPG HEALTH BAR PLZ HELP!

Postby xinfinite33 » Mon Mar 22, 2010 12:55 am

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? :(
xinfinite33
 
Posts: 2
Joined: Wed Mar 10, 2010 7:45 pm
Score: 0 Give a positive score

Re: RPG HEALTH BAR PLZ HELP!

Postby skydereign » Mon Mar 22, 2010 5:20 am

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);
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: RPG HEALTH BAR PLZ HELP!

Postby xinfinite33 » Tue Mar 23, 2010 2:41 am

thank you. works like a charm. i appreciate it :D
xinfinite33
 
Posts: 2
Joined: Wed Mar 10, 2010 7:45 pm
Score: 0 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron