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 non-enterable MapObject
10   * that is used for Grass Backgrounds.
11   * 
12   * @see Grass
13   * @see Wall
14   * @see MapObject
15   * @author Matt, Sam
16   * @version 1.3.4
17   */
18  public class Rock extends MapObject
19  {
20      /**
21       * The Image for the Rock
22       */
23      protected static Image img;
24  
25      /**
26       * Construct a Rock Object
27       */
28      public Rock()
29      {
30          enterable = false;
31          type = MapObject.ROCK;
32      }
33      /**
34       * Sets the Image to be used for the Rock.
35       * Needs to be called before paint is called.
36       * 
37       * @param img the Image to use.
38       */
39      public void setImage(Image[] img)
40      {
41          if(img.length == 1)
42              this.img = img[0];
43      }
44      /**
45       * Returns a clone of this.
46       * 
47       * @return a clone of this.
48       */
49      public MapObject getClone() { return new Rock(); }
50      /**
51       * Draws the Rock by paint the Image.
52       * 
53       * @param g the Graphics
54       */
55      public void paint(Graphics g)
56      {
57          g.drawImage(img, 0, 0, this);
58      }
59  }