package main;

import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

public class MapElement {

  private BufferedImage img;
  private boolean passable;

  public MapElement(BufferedImage img, boolean passable) {
    this.img = img;
    this.passable = passable;
  }

  public MapElement(String imgFile, boolean passable) {
    try {
      this.img = ImageIO.read(getClass().getResource("/images/" + imgFile));
      this.passable = passable;
    } catch (Exception ioe) {
      System.out.println("Failed to load image " + imgFile);
      ioe.printStackTrace();
    }
  }

  public MapElement(MapElement copy) {
    this.img = copy.img;
    this.passable = copy.passable;
  }

  public BufferedImage getImg() {
    return this.img;
  }

  public boolean isPassable() {
    return this.passable;
  }

  public void setImg(BufferedImage img) {
    this.img = img;
  }

  public void setPassable(boolean passable) {
    this.passable = passable;
  }
}
