source: lost-haven/main/MapElement.java@ 155577b

Last change on this file since 155577b was 0870468, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 4 years ago

Move all global classes into the main package

  • Property mode set to 100644
File size: 809 bytes
Line 
1package main;
2
3import java.awt.image.*;
4import java.io.IOException;
5
6import javax.imageio.ImageIO;
7
8public class MapElement {
9 private BufferedImage img;
10 private boolean passable;
11
12 public MapElement(BufferedImage img, boolean passable) {
13 this.img = img;
14 this.passable = passable;
15 }
16
17 public MapElement(String imgFile, boolean passable) {
18 try {
19 img = ImageIO.read(getClass().getResource("images/"+imgFile));
20 this.passable = passable;
21 }catch(IOException ioe) {
22 ioe.printStackTrace();
23 }
24 }
25
26 public BufferedImage getImg() {
27 return img;
28 }
29
30 public boolean isPassable() {
31 return passable;
32 }
33
34 public void setImg(BufferedImage img) {
35 this.img = img;
36 }
37
38 public void setPassable(boolean passable) {
39 this.passable = passable;
40 }
41}
Note: See TracBrowser for help on using the repository browser.