コード例 #1
0
  public void restart() {
    for (int i = 0; i < enemies.size(); i++) {
      enemies.get(i).kill();
    }

    Ghost g;
    Flyer f;

    Point[] walkers = new Point[] {new Point(390, 890), new Point(235, 890), new Point(400, 440)};
    for (int i = 0; i < walkers.length; i++) {
      g = new Ghost(tileMap);
      g.setPosition(walkers[i].x, walkers[i].y);
      enemies.add(g);
    }
    Point[] flyers =
        new Point[] {
          new Point(280, 560),
          new Point(190, 560),
          new Point(235, 410),
          new Point(310, 1340),
          new Point(190, 1340)
        };

    for (int i = 0; i < flyers.length; i++) {
      f = new Flyer(tileMap, false);
      f.setPosition(flyers[i].x, flyers[i].y);
      enemies.add(f);
    }
  }
コード例 #2
0
  public void populateEnemies() {
    enemies = new ArrayList<Enemy>();
    Ghost g;
    Flyer f;

    Point[] walkers = new Point[] {new Point(390, 890), new Point(235, 890), new Point(400, 440)};
    for (int i = 0; i < walkers.length; i++) {
      g = new Ghost(tileMap);
      g.setPosition(walkers[i].x, walkers[i].y);
      enemies.add(g);
    }
    Point[] flyers =
        new Point[] {
          new Point(280, 560),
          new Point(190, 560),
          new Point(235, 410),
          new Point(310, 1340),
          new Point(190, 1340)
        };

    for (int i = 0; i < flyers.length; i++) {
      f = new Flyer(tileMap, false);
      f.setPosition(flyers[i].x, flyers[i].y);
      enemies.add(f);
    }
  }