|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecterland.game.tetris.TetrisPlayer
public class TetrisPlayer
| Field Summary | |
|---|---|
protected boolean |
bEnd
true if game is completed or game over has occurred |
protected erland.game.tetris.Block |
block
Current active block in the main game area |
protected erland.game.tetris.Block |
blockNext
Current active block in the preview block area |
protected GameServerEnvironmentInterface |
environment
Game environment |
protected int |
level
Current level |
protected erland.game.tetris.BlockContainerData |
mainContainer
Container representing the main game area |
protected int |
MAX_LEVEL
Number of levels |
protected int |
MAX_SPEED
Maximum block speed |
protected int |
ROWS_PER_LEVEL
Number of rows that has to be removed before level is increased |
protected int |
rowsThisLevel
Number of rows that has been removed in this level |
protected long |
score
Current score |
protected int |
updateCounter
Counter that is increased every update, when it reaches the current game speed the active block will be moved down one step |
| Constructor Summary | |
|---|---|
TetrisPlayer(GameServerEnvironmentInterface environment)
|
|
| Method Summary | |
|---|---|
void |
doCommand(String command)
|
String |
getBlockString(erland.game.tetris.Block b)
|
NetworkConnectionInterface |
getConnection()
|
int |
getLevel()
|
erland.game.tetris.BlockContainerData |
getMainContainer()
|
erland.game.tetris.Block |
getNextBlock()
|
String |
getNumberString(int length,
long number)
|
long |
getScore()
|
void |
init()
|
boolean |
isCompleted()
|
boolean |
isGameOver()
|
boolean |
moveDown()
Move the active block in the main game area one step down |
boolean |
moveDownBottom()
|
boolean |
moveLeft()
Move the active block in the main game area one step left |
boolean |
moveRight()
Move the active block in the main game area one step right |
boolean |
needUpdate()
|
protected void |
removeCompletedRows()
Removes all completed rows in the main game area and increases score |
boolean |
rotateRight()
Rotate the active block in the main game area 90 degrees clockwize |
void |
setConnection(NetworkConnectionInterface connection)
|
void |
startNewGame()
|
String |
toString()
|
boolean |
update()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected erland.game.tetris.Block block
protected erland.game.tetris.Block blockNext
protected int updateCounter
protected final int MAX_LEVEL
protected final int MAX_SPEED
protected long score
protected int level
protected int rowsThisLevel
protected erland.game.tetris.BlockContainerData mainContainer
protected final int ROWS_PER_LEVEL
protected boolean bEnd
protected GameServerEnvironmentInterface environment
| Constructor Detail |
|---|
public TetrisPlayer(GameServerEnvironmentInterface environment)
| Method Detail |
|---|
public void setConnection(NetworkConnectionInterface connection)
setConnection in interface GamePlayerInterfacepublic NetworkConnectionInterface getConnection()
getConnection in interface GamePlayerInterfacepublic void doCommand(String command)
public void init()
public void startNewGame()
public boolean isGameOver()
public boolean isCompleted()
public boolean update()
protected void removeCompletedRows()
public String getBlockString(erland.game.tetris.Block b)
public String getNumberString(int length,
long number)
public String toString()
toString in class Objectpublic boolean moveLeft()
public boolean moveRight()
public boolean rotateRight()
public boolean moveDown()
public boolean moveDownBottom()
public boolean needUpdate()
public erland.game.tetris.BlockContainerData getMainContainer()
public erland.game.tetris.Block getNextBlock()
public long getScore()
public int getLevel()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||