finished grid update implementation
This commit is contained in:
13
grid.gd
13
grid.gd
@@ -102,12 +102,15 @@ func update_grid():
|
|||||||
set_token(temp_col[idx], rows - temp_col.size() + idx, col)
|
set_token(temp_col[idx], rows - temp_col.size() + idx, col)
|
||||||
|
|
||||||
# search for empty columns and compact horizontally
|
# search for empty columns and compact horizontally
|
||||||
var empty_columns = []
|
var temp_grid = grid.filter(func(col: Array): return !col.all(func(token): return token == null))
|
||||||
for col in range(cols):
|
|
||||||
if grid[col].all(func(token): return token == null):
|
|
||||||
empty_columns.append(col)
|
|
||||||
|
|
||||||
print(empty_columns)
|
var arr = []
|
||||||
|
arr.resize(rows)
|
||||||
|
arr.fill(null)
|
||||||
|
for _i in range(cols - temp_grid.size()):
|
||||||
|
temp_grid.append(arr)
|
||||||
|
|
||||||
|
grid = temp_grid
|
||||||
|
|
||||||
|
|
||||||
redraw_grid()
|
redraw_grid()
|
||||||
|
|||||||
Reference in New Issue
Block a user