| MapObject.java |
1 import java.awt.*;
2 import java.applet.*;
3 import javax.swing.*;
4 import java.awt.image.*;
5 import java.awt.geom.*;
6 import java.net.*;
7 /**
8 * Super class of all Objects on the Grid
9 *
10 * @see Grid
11 */
12 public abstract class MapObject extends Component
13 {
14 /**
15 * Type Grass
16 */
17 public static final int GRASS = 0;
18 /**
19 * Type Person
20 */
21 public static final int PERSON = 1;
22 /**
23 * Type Player
24 */
25 public static final int PLAYER = 2;
26 /**
27 * Type Rock
28 */
29 public static final int ROCK = 3;
30 /**
31 * Type Monster
32 */
33 public static final int MONSTER = 5;
34 /**
35 * Type Building
36 */
37 public static final int BUILDING = 6;
38 /**
39 * Type Floor
40 */
41 public static final int FLOOR = 7;
42 /**
43 * Type Redirect
44 */
45 public static final int REDIRECT = 8;
46 /**
47 * Type Wall
48 */
49 public static final int WALL = 9;
50 /**
51 * Type Trainer
52 */
53 public static final int TRAINER = 11;
54
55 /**
56 * true iff can be entered, ie Grass, Floor
57 */
58 protected boolean enterable;
59 /**
60 * The type of this
61 */
62 protected int type;
63
64 /**
65 * return a clone of this
66 *
67 * @return a clone of this
68 */
69 public abstract MapObject getClone();
70 /**
71 * Sets the image to display.
72 * Needs be called before paint
73 *
74 * @param img the array of images to use
75 */
76 public abstract void setImage(Image[] img);
77 /**
78 * return true if can be entered, ie Grass, Floor.
79 *
80 * @return true if can be entered, ie Grass, Floor.
81 */
82 public boolean canBeEntered() { return enterable; }
83 /**
84 * Gets the type associated with this.
85 *
86 * @return the type associated with this.
87 */
88 public int getType() { return type; }
89 }