diff --git a/src/game_ui.py b/src/game_ui.py index b0184fa..04dc057 100644 --- a/src/game_ui.py +++ b/src/game_ui.py @@ -18,6 +18,13 @@ class GameUi: coord = 'x' if self.agent.dir in (1, 3) else 'y' shift = -1 if self.agent.dir in (2, 3) else 1 # print(coord, shift) + test = int(getattr(self.agent, coord) + shift) + if coord == 'x': + if self.env.field[self.agent.y][test].number in (2, 3): + return + elif coord == 'y': + if self.env.field[test][self.agent.x].number in (2, 3): + return for x in range(8): setattr( self.agent, @@ -38,7 +45,7 @@ class GameUi: def rotate(self, dir): self.agent.dir = (self.agent.dir + dir) % 4 - print(self.agent.dir) + #print(self.agent.dir) self.agent.img = pg.image.load(SAPPER_IDLE[self.agent.dir]) self.update()