
12.12 Mouse Movements 883
12
13 private int xCtr; // x coordinate of center of treasure
14 private int yCtr; // y coordinate of center of treasure
15 private int x; // current x mouse position
16 private int y; // current y mouse position
17 private String status = “”; // message
18 private boolean gameOver = false;
19
20 /** Constructor
21 */
22 public TreasureHunt( )
23 {
24 Random random = new Random( );
25 xCtr = SIDE / 2 + random.nextInt( GAME_SIZE - SIDE );
26 yCtr = SIDE / 2 + random.nextInt( GAME_SIZE - SIDE );
27 }
28
29 /** isGameOver
30 * @return gameOver
31 */
32 public boolean isGameOver( )
33 {
34 return gameOver;
35 }
36
37 /** play
38 * @param x