Source code: org/meowers/cide/data/Tile.java
1 /*
2 * Tile.java
3 *
4 * Created on January 17, 2002, 12:01 AM
5 */
6
7 package org.meowers.cide.data;
8
9 import java.io.*;
10 import java.awt.*;
11 import java.awt.image.*;
12
13 /**
14 * A Tile is an element placed in a Map that represents one square of the
15 * game world.
16 * @author Adam Miezianko
17 * @version alpha-20206
18 * @since pre-alpha
19 */
20 public class Tile extends GameObject implements Serializable {
21
22 private String name = null; // name of the tile for the editor
23 private SerialImage tileImage = null;
24
25 /**
26 * Creates new empty Tile
27 */
28 public Tile() {
29 type = GameObject.TILE;
30 }
31
32 /**
33 * Sets the image of the <code>Tile</code>.
34 *
35 * @param tileImage a BufferedImage to use when displaying this Tile.
36 */
37 public void setImage(BufferedImage tileImage) {
38 this.tileImage = new SerialImage(tileImage);
39 dirty = true;
40 }
41
42 /**
43 * Gets the <code>BufferedImage</code> to display when rendering this
44 * <code>Tile</code>.
45 *
46 * @return a BufferedImage containing this <code>Tile</code>'s display
47 * image.
48 */
49 public BufferedImage getImage() {
50 if (tileImage != null)
51 return tileImage.getImage();
52 return null;
53 }
54
55 }