public abstract class GameModel
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
GameModel()
Create a new game model.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
gameUpdate(int lastKey)
This method is called repeatedly so that the game can update it's state.
|
java.awt.Dimension |
getGameboardSize()
Returns the size of the gameboard.
|
GameTile |
getGameboardState(int x,
int y)
Returns the GameTile in logical position (x,y) of the gameboard.
|
GameTile |
getGameboardState(Position pos)
Returns the GameTile in logical position (x,y) of the gameboard.
|
protected void |
setGameboardState(int x,
int y,
GameTile tile)
Set the tile on a specified position in the gameboard.
|
protected void |
setGameboardState(Position pos,
GameTile tile)
Set the tile on a specified position in the gameboard.
|
protected GameModel()
protected void setGameboardState(Position pos, GameTile tile)
pos
- The position in the gameboard matrix.tile
- The type of tile to paint in specified positionprotected void setGameboardState(int x, int y, GameTile tile)
x
- Coordinate in the gameboard matrix.y
- Coordinate in the gameboard matrix.tile
- The type of tile to paint in specified positionpublic GameTile getGameboardState(Position pos)
pos
- The position in the gameboard matrix.public GameTile getGameboardState(int x, int y)
x
- Coordinate in the gameboard matrix.y
- Coordinate in the gameboard matrix.public java.awt.Dimension getGameboardSize()
public abstract void gameUpdate(int lastKey) throws GameOverException
lastKey
- The most recent keystroke.GameOverException