Exemple #1
0
  /**
   * Draws the wall.
   *
   * @param g The graphics to draw into
   * @param r A room that is used to calculate were to draw the wall.
   */
  public void paint(Graphics g, Room r) {

    Images images = Images.instance();

    wallSize = (int) Math.round(Room.getSize() * 0.15);

    switch (direction) {
      case KeyEvent.VK_UP:
        g.drawImage(
            images.getWallUpImage(Room.getSize() - 2 * wallSize, wallSize),
            r.getOffsetX() + wallSize,
            r.getOffsetY(),
            null);
        break;

      case KeyEvent.VK_RIGHT:
        g.drawImage(
            images.getWallRightImage(wallSize, Room.getSize() - 2 * wallSize),
            r.getOffsetX() + Room.getSize() - wallSize,
            r.getOffsetY() + wallSize,
            null);
        break;

      case KeyEvent.VK_DOWN:
        g.drawImage(
            images.getWallDownImage(Room.getSize() - 2 * wallSize, wallSize),
            r.getOffsetX() + wallSize,
            r.getOffsetY() + Room.getSize() - wallSize,
            null);
        break;

      case KeyEvent.VK_LEFT:
        g.drawImage(
            images.getWallLeftImage(wallSize, Room.getSize() - 2 * wallSize),
            r.getOffsetX(),
            r.getOffsetY() + wallSize,
            null);
        break;
    }
  }
Exemple #2
0
 /**
  * Draws the door.
  *
  * @param g Graphics.
  * @param r The room that draws the door.
  */
 public void paint(Graphics g, Room r) {
   if (r.getOffsetY() < otherSideFrom(r).getOffsetY()) {
     // Down
     g.drawImage(
         Images.instance()
             .getDoorHorizontalImage(Room.getSize() - 2 * wallSize, 2 * halfDoorSize, isOpen),
         r.getOffsetX() + wallSize,
         r.getOffsetY() + Room.getSize() - halfDoorSize,
         null);
   }
   if (r.getOffsetY() > otherSideFrom(r).getOffsetY()) {
     // Up
     g.drawImage(
         Images.instance()
             .getDoorHorizontalImage(Room.getSize() - 2 * wallSize, 2 * halfDoorSize, isOpen),
         r.getOffsetX() + wallSize,
         r.getOffsetY() - halfDoorSize,
         null);
   }
   if (r.getOffsetX() < otherSideFrom(r).getOffsetX()) {
     // Left
     g.drawImage(
         Images.instance()
             .getDoorVerticalImage(2 * halfDoorSize, Room.getSize() - 2 * wallSize, isOpen),
         r.getOffsetX() + Room.getSize() - halfDoorSize,
         r.getOffsetY() + wallSize,
         null);
   }
   if (r.getOffsetX() > otherSideFrom(r).getOffsetX()) {
     // Right
     g.drawImage(
         Images.instance()
             .getDoorVerticalImage(2 * halfDoorSize, Room.getSize() - 2 * wallSize, isOpen),
         r.getOffsetX() - halfDoorSize,
         r.getOffsetY() + wallSize,
         null);
   }
 }
Exemple #3
0
 public Door(Room r1, Room r2) {
   halfDoorSize = Room.getSize() / 4;
   wallSize = (int) Math.round(Room.getSize() * 0.15);
   move(r1, r2);
 }
Exemple #4
0
 // S_Door
 public Door() {
   halfDoorSize = Room.getSize() / 4;
   wallSize = (int) Math.round(Room.getSize() * 0.15);
 }