Warn when health is low.

This commit is contained in:
Steve 2018-02-09 22:32:57 +00:00
parent 712a2c47b9
commit a6a3cbd6a6
2 changed files with 5 additions and 0 deletions

View File

@ -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;

View File

@ -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;