diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2023-05-08 13:07:48 +0300 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2023-05-08 13:07:48 +0300 |
| commit | c7c473177086399a8fb97936b4c3c2b67a43fce0 (patch) | |
| tree | 382cf7c0aacc90fd34b2989fb68ea34261d3a5b0 /src/player.py | |
| parent | 14be09cd58292f36c1922eddcfb43b750237751a (diff) | |
| download | Macpan-c7c473177086399a8fb97936b4c3c2b67a43fce0.tar.xz Macpan-c7c473177086399a8fb97936b4c3c2b67a43fce0.zip | |
Finished inky's algorithm and also added an option in settings to disable audio
Diffstat (limited to 'src/player.py')
| -rw-r--r-- | src/player.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/player.py b/src/player.py index 2c4c4f4..903c358 100644 --- a/src/player.py +++ b/src/player.py @@ -1,4 +1,3 @@ -from typing import List from direction import DIRECTION import map as Map from util import get_sprites @@ -14,7 +13,7 @@ class Player(): self.direction = DIRECTION.LEFT # checks if the current position of pacman is either a dot, big dot or free - def is_valid(self,maze, x, y): + def is_valid(self, maze, x, y): if x >= 0 and x < 30: is_dot = maze.maze[y][x] == Map.D is_big_dot = maze.maze[y][x] == Map.BD @@ -24,8 +23,8 @@ class Player(): return (is_dot or is_free or is_big_dot) return True - - # checks collision with pacman and obstacles returns false if there is a collision and true otherwise + # checks collision with pacman and obstacles returns false + # if there is a collision and true otherwise def check_collision(self, maze, dx, dy, tile_width, tile_height): direct_x = [1, 0, -1, 0, 1, 1, -1, -1] direct_y = [0, 1, 0, -1, -1, 1, -1, 1] @@ -44,7 +43,7 @@ class Player(): def draw(self, screen, counter): radius = 30 // 2 - pos = (self.x - radius , self.y - radius) + pos = (self.x - radius, self.y - radius) image = pygame.transform.scale(self.sprite[counter // 5], (35, 35)) if self.direction == DIRECTION.UP: screen.blit(pygame.transform.rotate(image, 270), pos) |
