Source of HarryPotterRoom.java


  1: 
  2: package maze.harry; 
  3: 
  4: import java.awt.*; 
  5: import java.applet.AudioClip; 
  6: import maze.*;
  7: 
  8: class HarryPotterRoom extends Room { 
  9: 
 10:   public static final Color ROOM_COLOR = new Color(85, 107, 47);
 11:   public static final Color PLAYER_COLOR = Color.black;
 12:   
 13:   public HarryPotterRoom(int roomNumber) { 
 14:     super(roomNumber);
 15:   }
 16: 
 17:   public void enter(Maze maze) {
 18:     maze.setCurrentRoom(this);
 19:     adapt.play();
 20:   }
 21: 
 22:   public void draw(Graphics g, int x, int y, int w, int h) {
 23:     g.setColor(ROOM_COLOR); 
 24:     g.fillRect(x, y, w, h); 
 25:     if (inroom) { 
 26:       g.setColor(PLAYER_COLOR);
 27:       g.fillOval(x + w / 2 - 5, y + h / 2 - 5, 10, 10); 
 28:     }
 29:   }
 30: 
 31:   protected static AudioClip adapt = util.AudioUtility.getAudioClip("audio/adapt-or-die.au");
 32: 
 33: }