Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / RPG health bar problem

Author
Message
Jonathan Valintine
19
Years of Service
User Offline
Joined: 30th Apr 2005
Location:
Posted: 28th May 2005 08:32
Is there any way in Dbpro to reduce the health bar via a percentage of size relevant to the total health.

example
the characters health is 250 and the enemy reduces it by say, 51 which would a decrease of 20.4%, so how would the health bar size decrease in proportion to it. Any help and/or input would very much appreciated.
blank
21
Years of Service
User Offline
Joined: 4th Mar 2003
Location: My Computer
Posted: 28th May 2005 09:00 Edited at: 28th May 2005 09:00
two boxes


i hope this helps you, unless you meant reducing by percentage based on your remaining health, try something like this

hope this helps you, good luck in your game

Formely Blank as a plank
Jonathan Valintine
19
Years of Service
User Offline
Joined: 30th Apr 2005
Location:
Posted: 28th May 2005 09:06
Thank you blank, you have really been a great help to me, I wish that one day I will be able to repay the favour. Again thank you.
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 29th May 2005 02:13
To get the percentage of your health:

Totalhealth = 200
Health = 150

Healthbar = (Health/Totalheath)*100

Resulting to 75, then just draw your health bar the size of the variable Healthbar

This however will limit your health bar to a maximum of 100.
Lets say you want to draw your health bar to have a maximum of 150 pixles across yet still show the true %, then rather than

Healthbar = (Health/Totalheath)*100

Use

healthbarPercent = (Health/Totalheath)*100
healthbar = (healthbarSize/100)*healthbarPercent

Where healthbarSize is the actual size of the health bar.

Hope this helps!

James

Hello!

Login to post a reply

Server time is: 2024-09-23 21:27:18
Your offset time is: 2024-09-23 21:27:18