public class RCModel extends Observable
move()
methods. Overloaded versions of move()
are used for mouse input.Modifier and Type | Field and Description |
---|---|
static int |
BOMB
This cell contains a bomb
|
static int |
EMPTY
This cell is empty
|
static int |
MINTILE
The smallest permitted board is 8x8.
|
static int |
POST
This cell contains an electified post
|
static int |
ROBOT
This cell contains a robot
|
static int |
WRECK
This cell is a collision among two or more robots
|
Constructor and Description |
---|
RCModel(int width,
int height)
Construct a game board with the given dimensions.
|
Modifier and Type | Method and Description |
---|---|
int[][] |
getBoard()
Return the game board array.
|
int |
getDeadRobots()
Return the curent score.
|
int |
getHeight()
Return the game board Height in Tiles.
|
int |
getLevel()
Return the curent game level.
|
int |
getLiveRobots()
Return the number of robots left on this level.
|
Point |
getPosition()
Return the player's current position as a
java.awt.Point . |
int |
getSafeJumps()
Return the number of safe jumps left.
|
int |
getWidth()
Return the game board Width in Tiles.
|
void |
initLevel()
Initialize the current level and notify any observers.
|
boolean |
lost()
Return true if the player has died; false otherwise.
|
void |
move()
Move by jumping to a random location.
|
boolean |
move(int key)
Move in the given direction.
|
boolean |
move(int row,
int col)
Move toward the specified row and column.
|
void |
newLevel()
Advance to the next level and initialize it.
|
void |
resetGame()
Reset the game and initialize the first level.
|
void |
resizeArray(int width,
int height)
Resize the game board array.
|
void |
restoreGame(int level,
int score,
int jumps)
Restore the game and initialize the current level.
|
boolean |
won()
Return true if the player has won; false otherwise.
|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
public static final int MINTILE
public static final int POST
public static final int BOMB
public static final int EMPTY
public static final int ROBOT
public static final int WRECK
public RCModel(int width, int height)
width
- board width measured in tilesheight
- board height measured in tilespublic void resizeArray(int width, int height)
width
- board width measured in tilesheight
- board height measured in tilespublic void resetGame()
public void restoreGame(int level, int score, int jumps)
level
- the previous levelscore
- the previous scorejumps
- the previous jumpspublic void newLevel()
public void initLevel()
public int getLevel()
public int getDeadRobots()
public int getLiveRobots()
public int getSafeJumps()
public int[][] getBoard()
public int getWidth()
public int getHeight()
public Point getPosition()
java.awt.Point
.
This point represents a two-dimensional array index:
point.x
holds the column index and
point.y
holds the row index.public boolean lost()
public boolean won()
public boolean move(int key)
key
- a numeric keypad key code (96-105)public boolean move(int row, int col)
row
- the given rowcol
- the given columnpublic void move()
Copyright © 2007 Gem City Software. Distributed under the terms of the GPL