Example #1
0
  /** Constructor for objects of class Scene8. */
  public Scene8(StarDuck starduck) {
    // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
    super(600, 400, 1);
    setBackground("background.png");
    this.starduck = starduck;
    starduck.setAdvance(false);

    Platform platform = new Platform();
    addObject(platform, 300, 400);

    Platform botPlatform = new Platform();
    botPlatform.getImage().scale(500, 25);
    addObject(botPlatform, 250, 250);

    Platform topPlatform = new Platform();
    topPlatform.getImage().scale(500, 25);
    addObject(topPlatform, 350, 100);

    addObject(starduck, 25, 338);

    // Start Zombies
    addZombie();
    addObject(new Zombie(this, false), 600, 338);
    addObject(new Zombie(this, false), 300, 200);
    addObject(new Zombie(this, false), 400, 338);
    addObject(new Zombie(this, false), 4, 200);
    addObject(new Zombie(this, false), 350, 338);
    addObject(new Zombie(this, false), 125, 200);

    healthHUD(starduck.getHealth());
    addObject(healthText, 75, 20);
  }
Example #2
0
 public void zombieDied() {
   kills++;
   if (kills < 4) {
     addZombie();
   } else if (kills == 10) {
     starduck.setAdvance(true);
   }
 }