Multiple Health Bar trouble

Game Editor comments and discussion.

Multiple Health Bar trouble

Postby Irondan75 » Thu Apr 14, 2011 12:01 am

So I have a main level and a Boss Battle level each in its own region. My main level has a player health bar that works great. My Boss level has a player bar and Boss bar,
my boss bar registers damage fine but my player bar does not. I scripted like this:

//main player

erase(0, 0, 0, 1);
for (i=0;i<maxhp;i++)
{
setpen(180, 0, 0, 0, 1);
moveto(i, 0);
lineto(i, height-1);
}
for (i2=0;i2<hp;i2++)
{
setpen(0, 0, 255, 0, 1);
moveto(i2, 0);
lineto(i2, height-1);
}


//Player in Boss level

erase(0, 0, 0, 1);
for (i=0;i<maxhp1;i++)
{
setpen(180, 0, 0, 0, 1);
moveto(i, 0);
lineto(i, height-1);
}
for (i2=0;i2<hp1;i2++)
{
setpen(0, 0, 255, 0, 1);
moveto(i2, 0);
lineto(i2, height-1);
}


//Boss enemy


erase(0, 0, 0, 1);
for (i=0;i<bossmaxhp;i++)
{
setpen(180, 0, 0, 0, 1);
moveto(i, 0);
lineto(i, height-1);
}
for (i2=0;i2<bosshp;i2++)
{
setpen(0, 0, 255, 0, 1);
moveto(i2, 0);
lineto(i2, height-1);
}


I have checked over and over my scripts in my player and enemy collision,draw,create scripts and they look fine.
I have the hp,hp1,maxhp,maxhp1,bosshp and bossmaxhp set in global variables...so I dont know what to look for next?

Is it possible to have two working health bars on one level?
Irondan75
 
Posts: 22
Joined: Thu Mar 10, 2011 12:10 pm
Score: 0 Give a positive score

Re: Multiple Health Bar trouble

Postby skydereign » Thu Apr 14, 2011 12:26 am

It is definitely possible, pretty much anything is. I'd suggest using only one player hp variable. Currently you have hp1 and hp. With this, you will have to code for dealing damage to two hp variables, where only one is required. The problem you are having sounds like you aren't lowering hp1 when you should. A good way to figure out what exactly is happening is to use text actors and display the variable values.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Multiple Health Bar trouble

Postby Irondan75 » Thu Apr 14, 2011 11:16 am

So I changed the hp1 and maxhp1 to str and strmax and got the same results. So I set the boss collision to my player as str-=10; and my player bar registers damage.
Why the boss bullet collision cant register but the boss collision can is odd :?
Irondan75
 
Posts: 22
Joined: Thu Mar 10, 2011 12:10 pm
Score: 0 Give a positive score

Re: Multiple Health Bar trouble

Postby skydereign » Thu Apr 14, 2011 7:04 pm

Not really sure what to tell you. I can get it to work, using the same code for either the boss collision or the bullet collision. Would you mind posting the source? It doesn't have to be the full ged, just enough to show the problem.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Multiple Health Bar trouble

Postby Irondan75 » Thu Apr 14, 2011 7:18 pm

Thanks for the offer and prior help Skydereign, but I always get an error when I log into the forum (Error: Permission to upload files denied.)
It's ok though, I just changed the end Boss fight to a cool path pattern the player needs to avoid while shooting back to destroy the Boss and it works pretty good with the flow of the game.

Gonna try to get it up in the Apple Store to see how it does.
Irondan75
 
Posts: 22
Joined: Thu Mar 10, 2011 12:10 pm
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest