0.5.2 #36

Merged
Lerking merged 2 commits from 0.5.2 into main 2025-04-21 13:56:52 +02:00
3 changed files with 49 additions and 23 deletions

29
maze/level_1_maze.txt Normal file
View File

@@ -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

41
pman.py
View File

@@ -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":

View File

@@ -1,2 +1,2 @@
pygame==2.6.1
pygameControls==0.0.4
pygamecontrols==0.1.9