style(game): rename shape to figure

This commit is contained in:
Kristofers Solo 2024-01-04 04:59:37 +02:00
parent 29c0460fb2
commit aa96feb93b
2 changed files with 8 additions and 8 deletions

View File

@ -11,14 +11,14 @@ from .timer import Timer, Timers
class Game: class Game:
def __init__(self, get_next_shape: Callable[[], Figure]) -> None: def __init__(self, get_next_figure: Callable[[], Figure]) -> None:
self.surface = pygame.Surface(CONFIG.game.size) self.surface = pygame.Surface(CONFIG.game.size)
self.dispaly_surface = pygame.display.get_surface() self.dispaly_surface = pygame.display.get_surface()
self.rect = self.surface.get_rect(topleft=CONFIG.game.pos) self.rect = self.surface.get_rect(topleft=CONFIG.game.pos)
self.sprites: pygame.sprite.Group[Block] = pygame.sprite.Group() self.sprites: pygame.sprite.Group[Block] = pygame.sprite.Group()
self.get_next_shape = get_next_shape self.get_next_shape = get_next_figure
self._create_grid_surface() self._create_grid_surface()

View File

@ -18,9 +18,9 @@ class Main:
self.display_surface.fill(CONFIG.colors.bg) self.display_surface.fill(CONFIG.colors.bg)
self.clock = pygame.time.Clock() self.clock = pygame.time.Clock()
self.next_shapes = self._generate_next_shapes() self.next_figures = self._generate_next_figures()
self.game = Game(self._get_next_shape) self.game = Game(self._get_next_figure)
self.score = Score() self.score = Score()
self.preview = Preview() self.preview = Preview()
@ -51,10 +51,10 @@ class Main:
pygame.quit() pygame.quit()
sys.exit() sys.exit()
def _generate_next_shapes(self, amount: int = 3) -> list[Figure]: def _generate_next_figures(self, amount: int = 3) -> list[Figure]:
return [Figure.random() for _ in range(amount)] return [Figure.random() for _ in range(amount)]
def _get_next_shape(self) -> Figure: def _get_next_figure(self) -> Figure:
next_shape = self.next_shapes.pop(0) next_shape = self.next_figures.pop(0)
self.next_shapes.append(Figure.random()) self.next_figures.append(Figure.random())
return next_shape return next_shape