示例#1
0
  private void startPairedAnimation(GameObject obj, int pos) {
    // find another object in chain to start animation on it
    Exit exit = obj.getAnimationEndExit();
    Point cornerCoords = obj.getCoordsFromCorner(exit.getCorner());
    int oldRow = pos / this.nCols + cornerCoords.x;
    int oldCol = pos % this.nCols + cornerCoords.y;

    int newRow = this.getPairedRow(exit.getDir(), oldRow);
    int newCol = this.getPairedCol(exit.getDir(), oldCol);

    if (this.hasPairedExit(newRow, newCol, exit.getDir())) {
      GameObject newObj = this.getObjectFromCoords(newRow, newCol);
      // if (!newObj.finishedAnimating()) {
      newObj.startAnimation(this.getPairedExit(newRow, newCol, exit.getDir()));
      // }
    } else {
      // this.startFailLevelAnimation(newRow, newCol, exit.getDir()); // todo maybe in the futute,
      // for now just reset animations
      this.resetAnimations();
      this.animationFinished(false);
    }
  }