feat: Added display of some agent variables
This commit is contained in:
parent
735867d51f
commit
6e94773b53
10
app.py
10
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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user