Game Development Community

Healthbar disappears

by Sabrecyd · in Torque Game Engine · 06/03/2003 (3:48 am) · 8 replies

I thought this was because something I did months ago but I was just looking at the new HEAD version of the engine and have noticed the same problem. The green healthbar fill part disappears as soon as the player takes any amount of damage. When the player health is at 100% it shows up fine. The outer box is always there. Anyone else seeing this problem?

thanks guys.

#1
06/03/2003 (4:08 am)
Yep I just tried it and I'm getting the same result. As soon as you take damage it appears that you have no energy left.
#2
06/03/2003 (4:18 am)
Ahh, cool, I thought I had messed with something and f*d it up for my game. Guess something was changed in one of the HEAD merges for my game. I'll take a look and see if I find the problem.
#3
06/03/2003 (8:05 am)
I don't want to even say how many times I looked thru code on the modified engine I have trying to figure out what I did to mess up the healthbar. Glad I'm not the only one seeing this.

Edit:
I should mention if people are experimenting with the demo branch it doesn't seem to have that same problem.
#4
06/03/2003 (2:31 pm)
I also have this problem and thought it was something I did. I have no idea how to fix it.
#5
06/04/2003 (11:02 am)
from DJMYSTIC

in guiHealthBarHud.cc

find all occurences of (S32) mValue

and change them to mValue
#6
06/04/2003 (11:49 am)
True, I'm sorry, this bug was introduced with the big patch I sent in to fix many compiler warnings, since doing that WILL give an extra warning, since it's not well done. When fixing it I didn't realize mValue was between 0 and 1 and not from 0 to 100, so eventually the value was being cut to either 1 or 0 if you had any damage. Sorry for the inconvenience, I will send in a patch to fix this in the correct way.
#7
06/04/2003 (12:05 pm)
Cool, thanks for the update guys.
#8
06/04/2003 (12:14 pm)
I submitted the fix to timg. Hopefully he'll get it into cvs soon, for now here's what to change.

Original code was:
rect.extent.x *= (S32) mValue;

New code:
rect.extent.x = (S32)(rect.extent.x * mValue);

Original code was:
rect.extent.y *= (S32) mValue;

New code:
rect.extent.y = (S32)(rect.extent.y * mValue);

Sorry for the inconvenience.