Don't show negative health on hud.
This commit is contained in:
parent
f1c3b3e680
commit
01246d14b6
|
@ -108,7 +108,9 @@ void drawHud(void)
|
|||
|
||||
static void drawHealth(void)
|
||||
{
|
||||
int w;
|
||||
int w, h;
|
||||
|
||||
h = MAX(world.bob->health, 0);
|
||||
|
||||
blitRect(atlasTexture->texture, 17, 17, &health->rect, 1);
|
||||
|
||||
|
@ -116,10 +118,10 @@ static void drawHealth(void)
|
|||
|
||||
drawRect(35, 8, w, 18, 0, 64, 0, 255);
|
||||
|
||||
w = world.bob->health * 12;
|
||||
w = h * 12;
|
||||
|
||||
drawRect(35, 8, w, 18, 0, 225, 0, 255);
|
||||
if (world.frameCounter % 60 < 30 && getPercent(world.bob->health, world.bob->healthMax) <= 33)
|
||||
if (world.frameCounter % 60 < 30 && getPercent(h, world.bob->healthMax) <= 33)
|
||||
{
|
||||
drawRect(35, 8, w, 18, 255, 225, 255, 255);
|
||||
}
|
||||
|
@ -128,7 +130,7 @@ static void drawHealth(void)
|
|||
|
||||
drawOutlineRect(35, 8, w, 18, 0, 0, 0, 255);
|
||||
|
||||
drawText(35 + w + 5, 7, 14, TA_LEFT, colors.white, "%d", world.bob->health);
|
||||
drawText(35 + w + 5, 7, 14, TA_LEFT, colors.white, "%d", h);
|
||||
}
|
||||
|
||||
static void drawPower(void)
|
||||
|
|
Loading…
Reference in New Issue