00:00
00:00
Newgrounds Background Image Theme

novaruah just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

RPG health bar tutorial

Share Collapse

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;
}
}

Log in / sign up to vote & review!

....

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

eeeh

the others were better

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...

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!!

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!

Credits & Info

Views
9,413
Faves:
13
Votes
23
Score
3.41 / 5.00

Uploaded
Aug 2, 2006
5:12 PM EDT