]> git.lizzy.rs Git - dungeon_game.git/commitdiff
Center healthbar
authorElias Fleckenstein <eliasfleckenstein@web.de>
Thu, 10 Jun 2021 19:35:12 +0000 (21:35 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Thu, 10 Jun 2021 19:35:12 +0000 (21:35 +0200)
plugins/game/game.c
plugins/healthbar/healthbar.c

index bd93419e5b72c1ce2f42aef12ab6c25f9a1e48de..ea6a665eb49e24270830005cef4b5701dc4f5479 100644 (file)
@@ -369,7 +369,7 @@ static void render_map(struct winsize ws)
                        printf(" ");
        }
 
-       for (int i = 0; i < rows_left + 1; i++)
+       for (int i = 0; i < rows_left; i++)
                for (int i = 0; i < ws.ws_col; i++)
                        printf(" ");
 }
index 5651051b4b572dd5b8dc9019481475469f503d08..c66d3f13c2333093d1c61efd649b63f2f566f95a 100644 (file)
@@ -7,7 +7,7 @@ static struct color gray;
 static void render_healthbar(struct winsize ws)
 {
        int y = max(ws.ws_row - 2, 0);
-       int x = max(ws.ws_col / 2 - player.max_health, 0);
+       int x = max(ws.ws_col / 2 - player.max_health / 2, 0);
 
        printf("\e[%u;%uH", y, x);