| Wall.java |
1 import java.awt.*;
2 import javax.swing.*;
3 import java.applet.*;
4 import java.awt.image.*;
5 import java.awt.geom.*;
6 import java.net.*;
7
8 /**
9 * Simple class to define a Wall,
10 * a non-enterable MapObject for
11 * levels that use the Floor as the backdrop.
12 *
13 * @see MapObject
14 * @see Floor
15 * @author Matt, Sam
16 * @version 1.2.3.4
17 */
18 public class Wall extends MapObject
19 {
20 /**
21 * The Image to display in with calls to paint
22 */
23 protected static Image img;
24 /**
25 * Create a new Wall Object.
26 */
27 public Wall()
28 {
29 enterable = false;
30 type = MapObject.WALL;
31 }
32 /**
33 * Sets the static Image associated with Wall.
34 * Required to call this before a call to paint can
35 * occur.
36 *
37 * @param img the Image to display
38 */
39 public void setImage(Image[] img)
40 {
41 if(img.length == 1)
42 this.img = img[0];
43 }
44 /**
45 * Returns a duplicate of this.
46 *
47 * @return a new MapObject of this
48 */
49 public MapObject getClone() { return new Wall(); }
50 /**
51 * Paints the image of the Wall.
52 *
53 * @param g the Graphics
54 */
55 public void paint(Graphics g)
56 {
57 g.drawImage(img, 0, 0, this);
58 }
59 }