diff --git a/dropzone.py b/dropzone.py index c2bd565..c6fa478 100644 --- a/dropzone.py +++ b/dropzone.py @@ -21,7 +21,7 @@ class DropZone(): for row_idx, row in enumerate(brick.shape): for col_idx, cell in enumerate(row): if cell: - globals.dropgrid[brick.y + row_idx][brick.x + col_idx] = 1 + globals.grid[brick.y + row_idx][brick.x + col_idx] = 1 self.dropzone.blit(brick.brick, (brick.y + row_idx, brick.x + col_idx)) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index ab12403..d174b3a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ numpy==2.2.5 pygame==2.6.1 -pygamecontrols==0.2.2 +pygamecontrols==0.2.5 diff --git a/tetris.py b/tetris.py index ce386aa..6ff62c7 100644 --- a/tetris.py +++ b/tetris.py @@ -100,7 +100,7 @@ class Tetris: case pygame.QUIT: self.running = False case pygame.KEYDOWN: - new_pos = pos[:] + #new_pos = pos[:] match event.key: case pygame.K_RIGHT: if self.current.direction == enums.BrickDirection.Dropped: @@ -193,7 +193,7 @@ class Tetris: if not self.current.update(): self.dropzone.lock(self.current) self.current = self.next - self.next = Brick(brick = randrange(0, len(BRICKS))) + self.next = Brick(brick = random.choice(list(BRICKS.keys()))) # Handle hotplugging case pygame.JOYDEVICEADDED: @@ -217,9 +217,11 @@ class Tetris: if "left button" in self.joysticks[self.joy.get_instance_id()].controllers[0].mapping: self.left_button = self.joysticks[self.joy.get_instance_id()].controllers[0].mapping["left button"] + else: self.left_button = None if "right button" in self.joysticks[self.joy.get_instance_id()].controllers[0].mapping: self.right_button = self.joysticks[self.joy.get_instance_id()].controllers[0].mapping["right button"] + else: self.right_button = None case pygame.JOYDEVICEREMOVED: del self.joysticks[event.instance_id]