diff --git a/maze/level_1_maze.txt b/maze/level_1_maze.txt new file mode 100644 index 0000000..8b6a26d --- /dev/null +++ b/maze/level_1_maze.txt @@ -0,0 +1,29 @@ +WWWWWWWWWWWWWWWWWWWWWWWWWWWWW +W.............W.............W +W.WWWWW.WWWWW.W.WWWWW.WWWWW.W +W*W W.W W.W.W W.W W*W +W.WWWWW.WWWWW.W.WWWWW.WWWWW.W +W...........................W +W.WWWWW.W.WWWWWWWWW.W.WWWWW.W +W.WWWWW.W.WWWWWWWWW.W.WWWWW.W +W.......W.....W.....W.......W +WWWWWWW.WWWWW.W.WWWWW.WWWWWWW +W W.WWWWW.W.WWWWW.W W +W W...............W W +WWWWWWW.W.WWWHHHWWW.W.WWWWWWW +........W.WHBHHHPHW.W........ +WWWWWWW.W.WHHHHHHHW.W.WWWWWWW +W W.W.WHIHHHCHW.W.W W +W W.W.WWWWWWWWW.W.W W +WWWWWWW.......M.......WWWWWWW +W.......WWWWWWWWWWWWW.......W +W.WWWWW.W W...W W.WWWWW.W +W*WWWWW.WWWWW.W.WWWWW.WWWWW*W +W...WW........W........WW...W +WWW.WW.WW.WWW...WWW.WW.WW.WWW +WWW.WW.WW.WWWWWWWWW.WW.WW.WWW +W......WW.....W.....WW......W +W.WWWWWWWWWWW.W.WWWWWWWWWWW.W +W.WWWWWWWWWWW.W.WWWWWWWWWWW.W +W...........................W +WWWWWWWWWWWWWWWWWWWWWWWWWWWWW diff --git a/pman.py b/pman.py index fb6dc8f..fa8af4a 100644 --- a/pman.py +++ b/pman.py @@ -7,7 +7,7 @@ from actors.ghost_mode_controller import GhostModeController from hud import HUD from maze import Maze -__version__ = "0.5.1" +__version__ = "0.5.2" # Constants HAT_REPEAT_DELAY = 0 # milliseconds before first repeat @@ -165,29 +165,26 @@ class Game: self.player.direction = PlayerDirection.DirectionRight self.player.move_right() elif self.hat_x == -1: - if event.type == pygame.USEREVENT and event.dict.get("type_name") == "JOYHATREPEAT": - if self.maze.is_wall(self.player.location[0] - 1, self.player.location[1]): - break - elif self.maze.is_ghost_home(self.player.location[0] - 1, self.player.location[1]): - break - self.player.direction = PlayerDirection.DirectionLeft - self.player.move_left() + if self.maze.is_wall(self.player.location[0] - 1, self.player.location[1]): + break + elif self.maze.is_ghost_home(self.player.location[0] - 1, self.player.location[1]): + break + self.player.direction = PlayerDirection.DirectionLeft + self.player.move_left() elif self.hat_y == 1: - if event.type == pygame.USEREVENT and event.dict.get("type_name") == "JOYHATREPEAT": - if self.maze.is_wall(self.player.location[0], self.player.location[1] - 1): - break - elif self.maze.is_ghost_home(self.player.location[0], self.player.location[1] - 1): - break - self.player.direction = PlayerDirection.DirectionUp - self.player.move_up() + if self.maze.is_wall(self.player.location[0], self.player.location[1] - 1): + break + elif self.maze.is_ghost_home(self.player.location[0], self.player.location[1] - 1): + break + self.player.direction = PlayerDirection.DirectionUp + self.player.move_up() elif self.hat_y == -1: - if event.type == pygame.USEREVENT and event.dict.get("type_name") == "JOYHATREPEAT": - if self.maze.is_wall(self.player.location[0], self.player.location[1] + 1): - break - elif self.maze.is_ghost_home(self.player.location[0], self.player.location[1] + 1): - break - self.player.direction = PlayerDirection.DirectionDown - self.player.move_down() + if self.maze.is_wall(self.player.location[0], self.player.location[1] + 1): + break + elif self.maze.is_ghost_home(self.player.location[0], self.player.location[1] + 1): + break + self.player.direction = PlayerDirection.DirectionDown + self.player.move_down() case pygame.USEREVENT: if event.dict.get("type_name") == "JOYHATREPEAT": diff --git a/requirements.txt b/requirements.txt index df19087..82aa9c8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ pygame==2.6.1 -pygameControls==0.0.4 +pygamecontrols==0.1.9