diff --git a/src/world/hud.c b/src/world/hud.c index 0840853..8efa499 100644 --- a/src/world/hud.c +++ b/src/world/hud.c @@ -110,6 +110,10 @@ static void drawHealth(void) w = world.bob->health * 12; drawRect(65, 8, w, 18, 0, 225, 0, 255); + if (world.frameCounter % 60 < 30 && getPercent(world.bob->health, world.bob->healthMax) <= 33) + { + drawRect(65, 8, w, 18, 255, 225, 255, 255); + } w = world.bob->healthMax * 12; diff --git a/src/world/hud.h b/src/world/hud.h index d2d5621..c35f43c 100644 --- a/src/world/hud.h +++ b/src/world/hud.h @@ -29,6 +29,7 @@ extern int getWrappedTextHeight(const char *text, int size); extern void blitRectScaled(SDL_Texture *texture, int x, int y, int w, int h, SDL_Rect *srcRect, int center); extern Texture *getTexture(const char *filename); extern SDL_Rect getCurrentFrame(Sprite *s); +extern int getPercent(float current, float total); extern Dev dev; extern Camera camera;