Exemple #1
1
  public void collided() {
    /*
     * Reduce 30% of current bar everytime
     */

    if (lives != 0) lives -= 0.2 * 100;
    else {
      Greenfoot.stop();
      add(new ScoreBoard(), 300, 300);
    }
  }
  /**
   * In the 'act()' method you can write your program for Kara <br>
   * <i>In der Methode 'act()' koennen die Befehle fuer Kara programmiert werden</i>
   */
  public void act() {
    if (onLeaf()) increaseLeaves();

    if (treeFront()) {
      Greenfoot.stop();
      System.out.println("leaves counted: " + countedLeaves);
    } else move();
  }
 public void updateLives() {
   lives.changeScore(-1);
   if (lives.getScore() == 0) {
     Greenfoot.stop();
   }
 }
  public void updateScore(int addCount) {

    universe.addObject(new ImageDisplay(), 1280, 720);
    Greenfoot.stop();
  }