source:
lost-haven/main/MapElement.java@
155577b
Last change on this file since 155577b was 0870468, checked in by , 5 years ago | |
---|---|
|
|
File size: 809 bytes |
Line | |
---|---|
1 | package main; |
2 | |
3 | import java.awt.image.*; |
4 | import java.io.IOException; |
5 | |
6 | import javax.imageio.ImageIO; |
7 | |
8 | public 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.