Mowing toward numpy for grid and bricks. /JL
This commit is contained in:
@@ -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]
|
||||
|
Reference in New Issue
Block a user