public boolean moveDown() { for (Cell cell : tetromino.getCells(this)) { if (isOccupied(cell.getCol(), cell.getRow() + 1)) return false; } tetromino.fall(); return true; }
public Cell getCell(int row, int col) { if (row < 0 || row >= HEIGHT || col < 0 || col >= WIDTH) { Cell a = new Cell(row, col); a.occupy(); return a; } return board[col][row]; }
/** Déplace le tetromino vers la droite */ public boolean moveRight() { for (Cell cell : tetromino.getCells(this)) if (isOccupied(cell.getCol() + 1, cell.getRow())) return false; tetromino.moveRight(); return true; }