Merge branch 'main' of git.gangary.cn:gary/maze_python
This commit is contained in:
commit
05b35d4640
7
maze.py
7
maze.py
@ -39,6 +39,7 @@ class Maze:
|
||||
for x in range(self.size):
|
||||
if self.grid[y][x] == '1':
|
||||
screen.blit(wall_texture, (x * tile_size, y * tile_size))
|
||||
continue
|
||||
if self.grid[y][x].startswith('g'):
|
||||
screen.blit(coin_texture, (x * tile_size, y * tile_size))
|
||||
|
||||
@ -75,7 +76,7 @@ class Maze:
|
||||
|
||||
if self.grid[y][x].startswith('|') or self.grid[y][x].startswith('-'):
|
||||
font = pygame.font.SysFont(None, tile_size // 2)
|
||||
num = 12
|
||||
num = int(self.grid[y][x][1:])
|
||||
center = (x * tile_size + tile_size // 2, y * tile_size + tile_size // 2)
|
||||
radius = tile_size // 3
|
||||
pygame.draw.circle(screen, (255, 215, 0), center, radius)
|
||||
@ -83,7 +84,7 @@ class Maze:
|
||||
text = font.render(str(num), True, (0, 0, 0))
|
||||
text_rect = text.get_rect(center=center)
|
||||
screen.blit(text, text_rect)
|
||||
|
||||
continue
|
||||
if self.grid[y][x].startswith('s'):
|
||||
font = pygame.font.SysFont(None, tile_size // 2)
|
||||
text = "s"
|
||||
@ -94,7 +95,7 @@ class Maze:
|
||||
text = font.render(text, True, (0, 0, 0))
|
||||
text_rect = text.get_rect(center=center)
|
||||
screen.blit(text, text_rect)
|
||||
|
||||
continue
|
||||
if self.grid[y][x].startswith('e'):
|
||||
font = pygame.font.SysFont(None, tile_size // 2)
|
||||
text = "e"
|
||||
|
Loading…
Reference in New Issue
Block a user