Updated. /JL
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user