From d41bde7f088abcf0a6005f817f53cad286345ca3 Mon Sep 17 00:00:00 2001 From: DannyAbdi <dannyabdi13@gmail.com> Date: Fri, 15 Mar 2024 02:43:41 +0000 Subject: [PATCH] fixed a bug that caused an attribute error when trying to draw the maze --- main.py | 4 ++-- player.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index d98dcec..8f69e29 100644 --- a/main.py +++ b/main.py @@ -34,14 +34,14 @@ run = True while run: timer.tick(FPS) maze.draw() - player.draw() + player.draw(screen) enemy1.draw(screen) easy_button.draw() normal_button.draw() hard_button.draw() # player_controller.move_to_goal_dfs() - # player_controller.move_to_goal_bfs() + player_controller.move_to_goal_bfs() # player_controller.move_to_goal_dijkstra() # player_controller.move_to_goal_astar() diff --git a/player.py b/player.py index e96c72f..4a4840a 100644 --- a/player.py +++ b/player.py @@ -18,5 +18,5 @@ class Player: This method utilizes the Pygame library to draw a white rectangle representing the player at the specified (x, y) coordinates with the size of TILE_SIZE. """ - def draw(self): + def draw(self, screen): pygame.draw.rect(screen, 'white', (self.x, self.y, TILE_SIZE, TILE_SIZE)) -- GitLab