Tetris: Blocks not dropping?

edited December 2015 in Using Processing

I have two shape arrays and this is the code I surrounded them in so that they scan under them to see if the the cell under is true or false. They only end up falling 1 cell and stopping immediately.

I feel the problem lies in lines 3 and 5. It seems to make sense. The block scans if the cell under is false, if it is, it changes it to true and drops while changing the one it just dropped one back to false.

if (shape[u].y < 19) {
  if (grid[shape[u].x][shape[u].y+1].onOff == false) {
    grid[shape[u].x][shape[u].y].onOff = false;
    grid[shape[u].x][shape[u].y+1].onOff = true;//removed +1 on .y
  if (shape[u].y >= 19) {
    grid[shape2[u].x][shape2[u].y].onOff = false;
    grid[shape2[u].x][shape2[u].y+1].onOff = true;


  • Answer ✓

    Line 5

    Remove +1 ???

  • I mean what is u?

    When the falling shape is more complex (a T or a + eg.), you can't check every cell in it but only those that form the lower base of the shape....

  • 'u' the variable I used in the for loop when iterating through the cells of the shape. Due to a time constraint, complex shapes are a little beyond me. But that helps.

Sign In or Register to comment.