Esempio n. 1
0
  Grille() {
    this._grilleJeu = new int[width][height];
    for (int y = 0; y < height; ++y) {
      for (int x = 0; x < width; ++x) {
        _grilleJeu[x][y] = 0;
      }
    }
    _pieceCourante = null;
    _pieceSuivante = Piece.GenererPieceAleatoire();

    this._piecePose = false;
    this._score = 0;
  }
Esempio n. 2
0
  public boolean Descendre() throws EndGameException {
    if (this._pieceCourante == null) {
      this._pieceCourante = this._pieceSuivante;
      this._pieceSuivante = Piece.GenererPieceAleatoire();
      this._xPiece = width / 2 - Piece.GetWidth() / 2;
      this._yPiece = height - Piece.GetWidth();

      EcrirePieceCourante();

      return false;
    }
    if (this._piecePose == true) {
      if (VerifierBordSuperieur() == true) {
        throw new EndGameException();
      }

      this._piecePose = false;
      DecalerLigne();
      this._pieceCourante = null;

      return false;
    }

    EffacerPieceCourante();
    if (Collision(this._pieceCourante.GetGrillePiece(), this._xPiece, this._yPiece - 1) == true) {
      EcrirePieceCourante();
      this._piecePose = true;

      return true;
    }

    --this._yPiece;
    EcrirePieceCourante();

    return false;
  }