zmiana rzedow z sprite.Group na pythonowa tablice #17

Merged
s464869 merged 1 commits from grid into master 2022-04-08 11:25:29 +02:00

View File

@ -28,9 +28,9 @@ class Grid:
podkladka[rzad][kolumna] = 2
else:
drzewa = drzewa - 1
print(podkladka)
for row in range(ROWS):
self.grid.append(pygame.sprite.Group())
self.grid.append([])
for column in range(COLUMNS):
box_rect = [(GRID_CELL_PADDING + GRID_CELL_WIDTH) * column + GRID_CELL_PADDING + 7,
(GRID_CELL_PADDING + GRID_CELL_HEIGHT) * row + GRID_CELL_PADDING + 7,
@ -57,7 +57,7 @@ class Grid:
else:
self.free_fields.append(field)
self.grid[row].add(field)
self.grid[row].append(pygame.sprite.Group(field))
def update(self, screen):
self.draw(screen)
@ -72,4 +72,5 @@ class Grid:
pygame.draw.rect(screen, (255, 255, 255), pygame.Rect(5, 5, bg_width, bg_height), 0, BORDER_RADIUS)
for fields_row in self.grid:
fields_row.draw(screen)
for fields in fields_row:
fields.draw(screen)