diff --git a/bricks.py b/bricks.py index f895d79..7660f04 100644 --- a/bricks.py +++ b/bricks.py @@ -47,8 +47,11 @@ class Brick: return True if self.state == enums.BrickState.Current else False def update(self): + if self.y + self.rows == globals.GRID_HEIGHT: + return False self.y += 1 self.location = (self.x, self.y) + return True def rotate_clockwise(self, shape): return [list(row)[::-1] for row in zip(*shape)] diff --git a/tetris.py b/tetris.py index c31eb46..2b25220 100644 --- a/tetris.py +++ b/tetris.py @@ -177,7 +177,9 @@ class Tetris: self.current.drop() case self.fall_timer: - self.current.update() + if not self.current.update(): + self.current = self.next + self.next = Brick(brick = randrange(0, len(BRICKS))) # Handle hotplugging case pygame.JOYDEVICEADDED: