From 5700cd89c8da523b54c1dfe9081f20546edaa3bc Mon Sep 17 00:00:00 2001 From: XsedoX Date: Fri, 8 Apr 2022 11:24:03 +0200 Subject: [PATCH] zmiana rzedow z sprite.Group na pythonowa tablice --- logic/grid.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/logic/grid.py b/logic/grid.py index ba9c9fd..ce1a675 100644 --- a/logic/grid.py +++ b/logic/grid.py @@ -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)