HUD: Health Bar basics
by Brendan McLeod · in Torque Game Engine · 05/28/2006 (8:08 pm) · 3 replies
Hi. I'm pretty new to this, so talk to me like you'd talk to a little tiny baby:
I put the GuiHealthBarHud into my world and it sits there just fine ... completely full. If my player takes damage, it doesn't show up on the Health Bar unless it's entirely gone -- in which case the bar disappears entirely.
How can I tie the bar directly to the health of my player, so that it decreases or increases appropriately?
I put the GuiHealthBarHud into my world and it sits there just fine ... completely full. If my player takes damage, it doesn't show up on the Health Bar unless it's entirely gone -- in which case the bar disappears entirely.
How can I tie the bar directly to the health of my player, so that it decreases or increases appropriately?
About the author
#2
05/28/2006 (9:40 pm)
It sounds like the health bar maximum value is ^10 of what they're meant to be, the player health is an Integer of 0 - 100, change the Maximum value of the health bar hud to match that of the player, ie. If the players max health is 100 chamnge the health bar max value to 100.
#3
Example:
F32 result = (U32)10 / (U32)50;
result will be 1 instead of 0.2
05/28/2006 (9:57 pm)
Made sure no variable was changed from a Float to an Int. If you divide with an integer, it will create an integer even if the result isnt even.Example:
F32 result = (U32)10 / (U32)50;
result will be 1 instead of 0.2
Torque Owner Chris Byars
Ion Productions