|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object erland.game.tetris.Block erland.game.tetris.Block2
Represents the block:
0xx0
0xx0
Field Summary | |
protected static java.awt.Color |
color
The color of the block |
protected int |
rotation
rotation angle of block |
protected int |
x
x position of block(This is a block coordinate and not a pixel coordinate) |
protected int |
y
y position of block(This is a block coordinate and not a pixel coordinate) |
Constructor Summary | |
(package private) |
Block2()
|
Method Summary | |
protected boolean |
check(BlockMatrix m,
int x,
int y,
int rotation)
Check if it is possible to put the block in the specified position and rotation angle |
java.lang.Object |
clone()
|
java.awt.Color |
getColor()
Get the color of the block |
int |
getRotation()
Get the rotation of the block |
int |
getX()
|
int |
getY()
|
protected void |
init(int x,
int y,
int rotation)
Initialize block |
boolean |
moveDown(BlockMatrix m)
Move block once step down |
boolean |
moveLeft(BlockMatrix m)
Move the block one step left |
boolean |
moveRight(BlockMatrix m)
Move the block one step right |
boolean |
rotateLeft(BlockMatrix m)
Rotate the block 90 degrees counter clockwize |
boolean |
rotateRight(BlockMatrix m)
Rotate the block 90 degrees clockwize |
protected void |
set(BlockMatrix m,
int x,
int y,
int rotation)
Put the block in the specified position and rotation angle |
protected void |
unset(BlockMatrix m,
int x,
int y,
int rotation)
Remove the block from the specified position and rotation angle |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.awt.Color color
protected int rotation
protected int x
protected int y
Constructor Detail |
Block2()
Method Detail |
public java.awt.Color getColor()
Block
getColor
in class Block
protected boolean check(BlockMatrix m, int x, int y, int rotation)
Block
check
in class Block
m
- The BlockMatrix in which the block residesx
- The x position which should be checked(Block coordinate)y
- The y position which should be checked(Block coordinate)rotation
- The rotation angle which should be checked
protected void unset(BlockMatrix m, int x, int y, int rotation)
Block
unset
in class Block
m
- The BlockMatrix in which the block residesx
- The x position (Block coordinate)y
- The y position (Block coordinate)rotation
- The rotation angleprotected void set(BlockMatrix m, int x, int y, int rotation)
Block
set
in class Block
m
- The BlockMatrix in which the block residesx
- The x position (Block coordinate)y
- The y position (Block coordinate)rotation
- The rotation anglepublic java.lang.Object clone()
public int getRotation()
public int getX()
public int getY()
protected void init(int x, int y, int rotation)
x
- x position of block(Block coordinate)y
- y position of block(Block coordinate)rotation
- rotation angle of blockpublic boolean moveDown(BlockMatrix m)
m
- The BlockMatrix in which the block resides
public boolean moveRight(BlockMatrix m)
m
- The BlockMatrix in which the block resides
public boolean moveLeft(BlockMatrix m)
m
- The BlockMatrix in which the block resides
public boolean rotateRight(BlockMatrix m)
m
- The BlockMatrix in which the block resides
public boolean rotateLeft(BlockMatrix m)
m
- The BlockMatrix in which the block resides
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |