Mowing toward numpy for grid and bricks. /JL

This commit is contained in:
2025-05-10 14:59:00 +02:00
parent 93e433fc1b
commit a349da2a58
3 changed files with 6 additions and 4 deletions

View File

@@ -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]