diff --git a/agent.py b/agent.py index 94b4d8b..c34ddcc 100644 --- a/agent.py +++ b/agent.py @@ -6,22 +6,21 @@ class Agent: self.istate = istate self.x, self.y, self.direction = istate self.grid_size = grid_size - self.image_original = pygame.image.load(image_path) - self.image_original = pygame.transform.scale(self.image_original, (grid_size, grid_size)) - self.image = self.image_original + self.image= pygame.image.load(image_path) + self.image = pygame.transform.scale(self.image, (grid_size, grid_size)) - def draw(self, screen): + def draw(self, screen, grid_size): # Obróć obrazek zgodnie z kierunkiem if self.direction == 'E': - self.image = pygame.transform.rotate(self.image_original, -90) + self.image= pygame.image.load('images/agent4.png') elif self.direction == 'S': - self.image = pygame.transform.rotate(self.image_original, 180) + self.image= pygame.image.load('images/agent1.png') elif self.direction == 'W': - self.image = pygame.transform.rotate(self.image_original, 90) + self.image= pygame.image.load('images/agent3.png') else: # direction == 'N' - self.image = self.image_original - + self.image= pygame.image.load('images/agent2.png') + self.image = pygame.transform.scale(self.image, (grid_size, grid_size)) screen.blit(self.image, (self.x * self.grid_size, self.y * self.grid_size)) def handle_event(self, event, max_x, max_y, animals, obstacles): diff --git a/images/agent1.png b/images/agent1.png new file mode 100644 index 0000000..6370d60 Binary files /dev/null and b/images/agent1.png differ diff --git a/images/agent2.png b/images/agent2.png new file mode 100644 index 0000000..4405e80 Binary files /dev/null and b/images/agent2.png differ diff --git a/images/agent3.png b/images/agent3.png new file mode 100644 index 0000000..3b850ad Binary files /dev/null and b/images/agent3.png differ diff --git a/images/agent4.png b/images/agent4.png new file mode 100644 index 0000000..a6feab8 Binary files /dev/null and b/images/agent4.png differ diff --git a/main.py b/main.py index e5c417b..9dcb48a 100644 --- a/main.py +++ b/main.py @@ -154,7 +154,7 @@ def generate_obstacles(): def main(): initial_state = (1,1,'W') - agent = Agent(initial_state, 'images/agent.png', GRID_SIZE) + agent = Agent(initial_state, 'images/agent1.png', GRID_SIZE) obstacles = generate_obstacles() @@ -185,7 +185,7 @@ def main(): spawned = True draw_Animals() opengates() - agent.draw(screen) + agent.draw(screen, GRID_SIZE) pygame.display.flip() clock.tick(10)