예제 #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 handleInput() {
    for (int i = 0; i < players.size(); i++) {

      MapObject m = players.get(switchable);

      m.setUp(Keys.keyState[Keys.UP]);
      m.setLeft(Keys.keyState[Keys.LEFT]);
      m.setDown(Keys.keyState[Keys.DOWN]);
      m.setRight(Keys.keyState[Keys.RIGHT]);
      m.setJumping(Keys.keyState[Keys.BUTTON1]);

      if (Keys.isPressed(Keys.BUTTON2)) {
        m.setUp(false);
        m.setLeft(false);
        m.setDown(false);
        m.setRight(false);
        m.setJumping(false);
        switchActiveUp();

      } else {
        switched = 0;
      }
    }
  }