From 5cbbf9bdcbe725247a9b33c11c123cd27e37d99d Mon Sep 17 00:00:00 2001 From: Jan Lerking Date: Thu, 24 Apr 2025 06:26:41 +0200 Subject: [PATCH] Updated. /JL --- bricks.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bricks.py b/bricks.py index 0a42f12..1bf9b2c 100644 --- a/bricks.py +++ b/bricks.py @@ -64,7 +64,7 @@ class Brick: for row_idx, row in enumerate(shape): for col_idx, cell in enumerate(row): if cell: - new_x = x +col_idx + new_x = x + col_idx new_y = y + row_idx if new_x <= 0 or new_x >= GRID_WIDTH or new_y >= GRID_HEIGHT: return True @@ -77,8 +77,11 @@ class Brick: print(f"State set to {self.state}") def move_right(self): - self.x += 1 - self.location = (self.x, self.y) + if self.collision(self.layout, self.x, self.y): + return + else: + self.x += 1 + self.location = (self.x, self.y) def move_left(self): self.x -= 1