Be a Supporter!

RPG health bar tutorial

Score:
rated 2.10 / 5 stars
Views:
8,180 Views
Share Links:
Genre:
More Games
Tags:
None

Credits & Info

Uploaded
Aug 2, 2006 | 5:12 PM EDT

If you liked this, check these out!


Author Comments

This is a great tutorial of how to make a health bar. It's more like a "How to represent a variable in a bar" tutorial, I'm just using health as an example.

Ok, for all of you who complained:
To make a limit for your bar just modify the code:

hp = 100;
hpMax = 100;

function updateHealthBar()
{
var percentage = hp / hpMax * 100;
myBar._xscale = percentage;
}

to:

hp = 100;
hpMax = 100;

function updateHealthBar()
{
if(hp > -1){
var percentage = hp / hpMax * 100;
myBar._xscale = percentage;
}
}

Reviews


theironpawtheironpaw

Rated 3.5 / 5 stars

....

yea your bar goes into the negitive how do we make it stop at zero?



theprostreettheprostreet

Rated 4 / 5 stars

eeeh

the others were better



black696black696

Rated 4.5 / 5 stars

Nice

I dont need the code for the bar to stop going to negative because the hp of my char cant go negative coz it is already present in the code...



joakkarjoakkar

Rated 3.5 / 5 stars

took some work to do...

Finally!
After some hard thinking, I finally made it work properly ^^
Maybe you should've been more specific on some parts but it's a good tut anyways.
Thanx!!



lMorningAfterllMorningAfterl

Rated 3.5 / 5 stars

Good Tutorial!

Really helpful but i just have a quick question...im not 100% sure if you explained this but...lets say im making a different game and my guy gets hurt...his health is at 70%...how do i make it so when my guy goes to the next level or frame..the health will be 70%
(I've tried and copying the health from the first frame but it doesnt work)
Sorry for the questions lol...make more tutorials this was very informative
Thanks!