예제 #1
0
  public void draw(Graphics2D g) {

    bg.draw(g);

    tileMap.draw(g);

    for (int i = 0; i < pictures.size(); i++) {
      Images j = pictures.get(i);
      j.draw(g);
    }

    //		pinkDoor.Draw(g);
    //		greenDoor.Draw(g);
    for (int i = 0; i < buttons.size(); i++) {
      Button b = buttons.get(i);
      b.draw(g);
    }
    for (int i = 0; i < doors.size(); i++) {
      Door d = doors.get(i);
      d.Draw(g);
    }
    for (int i = 0; i < players.size(); i++) {
      MapObject m = players.get(i);
      m.draw(g);
    }

    for (int i = 0; i < walls.size(); i++) {
      walls.get(i).draw(g);
    }
    if (!fadein.isDone()) {
      fadein.draw(g);
    }
    fadeout.draw(g);
  }
예제 #2
0
  public void update() {

    handleInput();
    if (!fadein.isDone()) {
      fadein.update();
    }
    if (!fadeout.isDone()) {
      fadeout.update();
    }
    if (gsm.getCurrentLevel() == 4) {
      ji.checkCatch(rae);
    }

    for (int i = 0; i < pictures.size(); i++) {
      Images j = pictures.get(i);
      j.update();
    }

    whatUpdate();
    bg.update();

    for (int i = 0; i < walls.size(); i++) {
      Wall w = walls.get(i);
      if (!w.removed()) {
        w.checkCollision(ji);
        w.checkCollision(rae);
      }
      if (w.shouldRemove()) {
        walls.remove(wall);
        i--;
      }
    }

    // wall.checkCollision(ji);
  }
예제 #3
0
  public void setItUp() {

    pictures = new ArrayList<Images>();

    if (gsm.getCurrentLevel() == 1) {
      ji = new Ji(tileMap, true);
      ji.setPosition(80, 400);
      players.add(ji);
      image = new Images(tileMap, "/Backgrounds/Texts/LevelOne.png");
      image.setPosition(320, 240);
      pictures.add(image);
      image = new Images(tileMap, "/Maps/Other/LevelOne.png");
      image.setPosition(320, 240);
      pictures.add(image);
    }

    if (gsm.getCurrentLevel() == 2) {
      rae = new Rae(tileMap, true);
      rae.setPosition(580, 400);
      players.add(rae);
      image = new Images(tileMap, "/Backgrounds/Texts/LevelTwo.png");
      image.setPosition(320, 240);
      pictures.add(image);
    }

    if (gsm.getCurrentLevel() == 3) {
      ji.setPosition(80, 400);
      rae.setPosition(580, 400);
      image = new Images(tileMap, "/Backgrounds/Texts/LevelThree.png");
      image.setPosition(320, 240);
      pictures.add(image);
      image = new Images(tileMap, "/Maps/Other/LevelThree.png");
      image.setPosition(320, 240);
      pictures.add(image);
    }

    if (gsm.getCurrentLevel() == 4) {
      ji.setPosition(80, 400);
      rae.setPosition(160, 400);
      image = new Images(tileMap, "/Backgrounds/Texts/LevelFour.png");
      image.setPosition(320, 240);
      pictures.add(image);
    }

    if (gsm.getCurrentLevel() == 5) {
      ji.setPosition(80, 400);
      rae.setPosition(160, 400);
    }

    if (gsm.getCurrentLevel() == 6) {
      ji.setPosition(50, 400);
      rae.setPosition(80, 400);
      image = new Images(tileMap, "/Backgrounds/Texts/LevelSix.png");
      image.setPosition(320, 240);
      pictures.add(image);
    }

    if (gsm.getCurrentLevel() == 7) {
      ji.setPosition(300, 400);
      rae.setPosition(340, 400);
    }

    if (gsm.getCurrentLevel() == 8) {
      ji.setPosition(240, 415);
      rae.setPosition(60, 160);
      setActivePlayer(1);
      image = new Images(tileMap, "/Backgrounds/Texts/LevelEight.png");
      image.setPosition(320, 240);
      pictures.add(image);
    }

    if (gsm.getCurrentLevel() == 9) {
      ji.setPosition(260, 250);
      rae.setPosition(240, 415);
      image = new Images(tileMap, "/Maps/Other/LevelEleven.png");
      image.setPosition(320, 431);
      pictures.add(image);
    }

    if (gsm.getCurrentLevel() == 10) {
      ji.setPosition(350, 415); // 350 415
      rae.setPosition(350, 100);
      setActivePlayer(0);
      wall = new Wall(3, "vert", "anything", tileMap);
      wall.setPosition(144, 144);
      walls.add(wall);
      button = new Button(tileMap, "left", "break", wall);
      button.setPosition(592, 432);
      buttons.add(button);
      image = new Images(tileMap, "/Backgrounds/Texts/LevelTen.png");
      image.setPosition(320, 240);
      pictures.add(image);
    }
  }