Exemplo n.º 1
0
  public void startGame() {
    hasStarted = true;

    // reset grid
    gridManager.clearGrid();

    // generate random piece
    currentPiece = pieceGenerator.getRandomPiece();

    // set pieceController to currentPiece
    pieceController.setCurrentTetrisPiece(currentPiece);

    pieceController.placeCurrentTetrisPieceAt(2, 2);

    // other stuff like clearing levels and score.
  }
Exemplo n.º 2
0
 // this should be an interface
 public void performAction(Actions action) {
   switch (action) {
     case LEFT:
       pieceController.moveTetrisPieceLeft();
       break;
     case RIGHT:
       pieceController.moveTetrisPieceRight();
       break;
     case DROP:
       pieceController.dropTetrisPiece();
       break;
     case ROTATE:
       pieceController.rotateTetrisPiece();
       break;
   }
 }
Exemplo n.º 3
0
 public void performNextIteration() {
   currentPiece = pieceGenerator.getRandomPiece();
   pieceController.setCurrentTetrisPiece(currentPiece);
 }