Hi guys. I have made a tetris clone but I am unsure whether my cascade logic works fine or not. In the uploaded image when line 1 and 2 clears, 3(J), 4(T) and 5(S) will fall together first and then lock in place. Once these 3 have locked in place the next piece 6(T) will start falling. The logic works as follows: 1. Check for first line above cleared line. 2. If tetromino found then fall all the tetrominoes in that line together as much as possible. 3. Check for next above line and repeat steps 1 and 2 up until top of board is reached. I am a little doubtful about its working. Can anyone please guide me with how cascade drop works in tetris? Thanks, C. Pednekar.
How cascade works depends on the game. In games with sticky tetriminoes, cells that are the same color automatically link together. Clearing a line can break links, and cause stuff to fall. it sticks at the END of it's fall. everything that can fall falls simultaneously as many lines together as possible. then stuff that can go farther falls. once all possible falling is done, stickyness is rechecked, and then a check for cleared lines is done. For games that don't have sticky colors, only the original tetrimino cells stay stuck together. clearing lines breaks links still, and falling still happens to all linked groups of cells that aren't supported. but in this case, they are not re-glued back together for any reason. Cascade tetris in tetris worlds works this way. So here's how it goes. after pieces lock 1) if color sticky mode is used (The Next Tetris) perform sticky check immediately on lockdown. link all cells together that are the same color. they are considered a group, and fall or don't fall together. 2) perform cascade check. check all linked groups of cells from bottom up. if every cell that's one below a cell that's part of the group is empty or belongs to the group, mark it as free to fall. If any cell in the line was marked as free to fall, rerun the check for that line, considering all cells marked as free to fall as empty. if nothing is marked as free to fall, skip to 4. 3) perform cascade gravity. move all items marked as falling down one row. return to step 2, skipping stickiness check until everything is done falling. 4) if color stick is used, perform stickiness check to glue all matching color cells together. 5) perform line clear check. clear any filled lines. if lines were cleared, return to step 1.