mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 14:59:03 -06:00
Changed row initialization to also use parametrized width.
This commit is contained in:
parent
0f09d47e60
commit
2d63ca8ee1
@ -129,8 +129,12 @@ function Grid:clearClearedRows()
|
||||
self.grid[above_row] = self.grid[above_row - 1]
|
||||
self.grid_age[above_row] = self.grid_age[above_row - 1]
|
||||
end
|
||||
self.grid[1] = {empty, empty, empty, empty, empty, empty, empty, empty, empty, empty}
|
||||
self.grid_age[1] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
self.grid[1] = {}
|
||||
self.grid_age[1] = {}
|
||||
for i = 1, self.width do
|
||||
self.grid[1][i] = empty
|
||||
self.grid_age[1][i] = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
@ -141,10 +145,11 @@ function Grid:copyBottomRow()
|
||||
self.grid[row] = self.grid[row+1]
|
||||
self.grid_age[row] = self.grid_age[row+1]
|
||||
end
|
||||
self.grid[24] = {empty, empty, empty, empty, empty, empty, empty, empty, empty, empty}
|
||||
self.grid_age[24] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
for col = 1, self.width do
|
||||
self.grid[24][col] = (self.grid[23][col] == empty) and empty or block
|
||||
self.grid[24] = {}
|
||||
self.grid_age[24] = {}
|
||||
for i = 1, self.width do
|
||||
self.grid[24][i] = (self.grid[23][i] == empty) and empty or block
|
||||
self.grid_age[24][i] = 0
|
||||
end
|
||||
return true
|
||||
end
|
||||
@ -154,10 +159,11 @@ function Grid:garbageRise(row_vals)
|
||||
self.grid[row] = self.grid[row+1]
|
||||
self.grid_age[row] = self.grid_age[row+1]
|
||||
end
|
||||
self.grid[24] = {empty, empty, empty, empty, empty, empty, empty, empty, empty, empty}
|
||||
self.grid_age[24] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
for col = 1, self.width do
|
||||
self.grid[24][col] = (row_vals[col] == "e") and empty or block
|
||||
self.grid[24] = {}
|
||||
self.grid_age[24] = {}
|
||||
for i = 1, self.width do
|
||||
self.grid[24][i] = (row_vals[i] == "e") and empty or block
|
||||
self.grid_age[24][i] = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user