From 6e94773b5352db434439e855b93f877164dabb4e Mon Sep 17 00:00:00 2001 From: Jager72 <49473040+Jager72@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:50:46 +0100 Subject: [PATCH] feat: Added display of some agent variables --- app.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index a10c235..689ad1f 100644 --- a/app.py +++ b/app.py @@ -31,12 +31,18 @@ def initBoard(): cells[6][4].interactableItem = BeerKeg(cells[6][4], "Beer Keg") cells[4][10].interactableItem = CoffeMachine(cells[4][10], "Coffe Machine") -def draw_grid(window, cells): +def draw_grid(window, cells, agent): for i in range(prefs.GRID_SIZE): for j in range(prefs.GRID_SIZE): cells[i][j].update(window) if(cells[i][j].interactableItem): cells[i][j].interactableItem.update(window) + font = pygame.font.SysFont('Comic Sans MS', 30) + scoreText = font.render("Score: {}".format(str(round(agent.score,2))), 1, (0, 0, 0)) + multiplierText = font.render("Multiplier: {}".format(str(round(agent.multiplier,2))), 1, (0, 0, 0)) + + window.blit(scoreText, (0, 0)) + window.blit(multiplierText, (0, 50)) initBoard() agent = Agent(prefs.SPAWN_POINT[0], prefs.SPAWN_POINT[1], cells) @@ -66,7 +72,7 @@ while running: window.fill((255, 0, 0)) - draw_grid(window, cells) + draw_grid(window, cells, agent) agent.update(window) pygame.display.update()