We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5945eb4 commit 4f2200cCopy full SHA for 4f2200c
1 file changed
src/application.py
@@ -90,11 +90,14 @@ def _draw_tiles(self) -> None:
90
mouse_pos = pygame.mouse.get_pos()
91
x, y = ((mouse_pos[0] // TILE_SIZE), ((mouse_pos[1] - HEADER_SIZE) // TILE_SIZE))
92
93
- if 0 <= y < TILES_HEIGHT and 0 <= x < TILES_WIDTH:
94
- if self.grid[y][x] == ' ' and self.mouse_down[0] == 1:
95
- self.grid[y][x] = '#'
96
- if self.grid[y][x] == '#' and self.mouse_down[0] == 3:
97
- self.grid[y][x] = ' '
+ if 0 > y >= TILES_HEIGHT and 0 > x >= TILES_WIDTH: return
+
+ if x == (TILES_WIDTH - 2) and y == (TILES_HEIGHT - 2): return
+ if self.grid[y][x] == ' ' and self.mouse_down[0] == 1:
98
+ self.grid[y][x] = '#'
99
+ if self.grid[y][x] == '#' and self.mouse_down[0] == 3:
100
+ self.grid[y][x] = ' '
101
102
self.renderer.update_walls(self.grid)
103
0 commit comments