Updated. /JL

This commit is contained in:
2025-04-25 21:37:53 +02:00
parent 1daa534b6f
commit 6cb3433259
2 changed files with 14 additions and 13 deletions

View File

@@ -3,8 +3,6 @@ import globals
import enums import enums
from random import choice from random import choice
class Brick: class Brick:
def __init__(self, brick, state = enums.BrickState.Next): def __init__(self, brick, state = enums.BrickState.Next):
self.shape = [] self.shape = []
@@ -72,6 +70,7 @@ class Brick:
new_x = x + col_idx new_x = x + col_idx
new_y = y + row_idx new_y = y + row_idx
if new_x <= 0 or new_x >= globals.GRID_WIDTH or new_y >= globals.GRID_HEIGHT: if new_x <= 0 or new_x >= globals.GRID_WIDTH or new_y >= globals.GRID_HEIGHT:
print(f"Collision X:{new_x}, Y:{new_y}")
return True return True
if new_y >= 0 and globals.dropgrid[new_y][new_x]: if new_y >= 0 and globals.dropgrid[new_y][new_x]:
return True return True
@@ -82,18 +81,20 @@ class Brick:
print(f"State set to {self.state}") print(f"State set to {self.state}")
def move_right(self): def move_right(self):
if self.collision(self.shape, self.x, self.y): print(f"X: {self.x}")
return if self.x != 0:
else: if self.collision(self.shape, self.x, self.y):
self.x += 1 return
self.location = (self.x, self.y) self.x += 1
self.location = (self.x, self.y)
def move_left(self): def move_left(self):
if self.collision(self.shape, self.x, self.y): print(f"X: {self.x}")
return if self.x != globals.GRID_WIDTH:
else: if self.collision(self.shape, self.x, self.y):
self.x -= 1 return
self.location = (self.x, self.y) self.x -= 1
self.location = (self.x, self.y)
def drop(self): def drop(self):
print("Dropping") print("Dropping")

View File

@@ -10,7 +10,7 @@ from dropzone import DropZone
from dropnext import DropNext from dropnext import DropNext
from hud import Hud from hud import Hud
__version__ = "0.1.0" __version__ = "0.1.1"
# Constants # Constants
HAT_REPEAT_DELAY = 0 # milliseconds before first repeat HAT_REPEAT_DELAY = 0 # milliseconds before first repeat