Update GridMap.gd

This commit is contained in:
adrienmalin 2019-01-08 14:40:27 +01:00
parent ed5924f407
commit 574e22ef74

View File

@ -41,11 +41,12 @@ func possible_positions(initial_positions, movement):
return [] return []
func lock(piece): func lock(piece):
var minoes_over_grid = 0
for position in piece.positions(): for position in piece.positions():
if position.y >= NB_LINES: if position.y >= NB_LINES:
return false minoes_over_grid += 1
set_cell_item(position.x, position.y, 0, MINO) set_cell_item(position.x, position.y, 0, MINO)
return true return minoes_over_grid < Tetromino.NB_MINOES
func clear_lines(): func clear_lines():
var line_cleared var line_cleared