game over if piece is out of matrix's window
This commit is contained in:
parent
a6b2d82825
commit
e4a3d44740
@ -327,10 +327,11 @@ class Matrix(Window):
|
|||||||
def lock(self, t_spin):
|
def lock(self, t_spin):
|
||||||
for mino in self.piece.minoes:
|
for mino in self.piece.minoes:
|
||||||
position = mino.position + self.piece.position
|
position = mino.position + self.piece.position
|
||||||
if position.y > 0:
|
if position.y >= 0:
|
||||||
self.cells[position.y][position.x] = mino.color
|
self.cells[position.y][position.x] = mino.color
|
||||||
else:
|
else:
|
||||||
self.game.over()
|
self.game.over()
|
||||||
|
return
|
||||||
|
|
||||||
nb_lines_cleared = 0
|
nb_lines_cleared = 0
|
||||||
for y, line in enumerate(self.cells):
|
for y, line in enumerate(self.cells):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user