Updated. /JL
This commit is contained in:
39
pman.py
39
pman.py
@@ -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":
|
||||
|
Reference in New Issue
Block a user