示例#1
0
  /**
   * Handles what happens if the player has won or has tried to jump to a different level (even if
   * the player didn't actually win)
   *
   * @param playerScore
   * @param playerLives
   * @param down
   */
  public void win(int playerScore, int playerLives, boolean down) {
    int upOrDown;
    if (down) upOrDown = -1;
    else upOrDown = 1;

    this.thePlayer.setLevel(this.thePlayer.getLevel() + upOrDown);
    this.thePlayer.setScore(this.thePlayer.getScore() + playerScore);
    this.thePlayer.setLives(playerLives);

    //	System.out.println(this.thePlayer.getName() + " is going to ");
    //	System.out.println("level " + this.thePlayer.getLevel());
    SimulationPanel thePanel = new SimulationPanel(this.load, this.thePlayer, this.soundOn, false);
    try {
      thePanel.load();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    killThread();
  }