After you clear a row (as you did in the
previous homework),
the row looks empty,
so all remaining blocks above it will "fall down".
For a cell to "fall down", you may simply increase its y
coordinate, and draw it at the new location.
You can do this
by copying upper rows to lower rows).
Don't forget to update the array occupied[][] accordingly.
String sp(" ");
for (j=0; j<nWidth; j++)
{
color = occupied[i+drop][j] = occupied[i][j];
sp.show(i, 2*j, color);
}
If only one row is cleared, the y coordinates of cells are only
incremented by 1.
If two rows are cleared, the y coordinates of cells are
incremented by 2.
Please note that the two cleared rows may not be consecutive.
For example, it is possible that row 16 and row 18 are cleared, but
row 17 remains.
Now you can add some rules to accumulate points to make this like a
real TETRIS game. For example,
When each tetromino touches down, you get 1 point.