|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unifreiburg.informatik.tetris.game.block.Block
public class Block
Constructor Summary | |
---|---|
Block(CartPt coords,
java.awt.Color c)
Create a new Block at position (x,y) if (x,y) = coords. |
|
Block(int x,
int y,
java.awt.Color c)
Create a new Block at position (x,y) if (x,y) = coords. |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics g,
int blocksize,
int gap)
Draws the block using the graphic g. |
void |
draw(java.awt.Graphics g,
int blocksize,
int gap,
boolean turnpoint)
Draws a block, and can draw the turnblocks also. |
(package private) int |
getY()
This method is only allowed to use in the package |
boolean |
isFree(BlockList bl)
This method is used by the add method to check if we can add the block to the blocklist bl. |
boolean |
isFree(CartPt coords)
Use this method to check if the block is at the given position. |
boolean |
isMoveable(de.unifreiburg.informatik.tetris.game.Field f,
CartPt coords)
Checks if a move is possible. |
boolean |
isTurnableClockwise(de.unifreiburg.informatik.tetris.game.Field f,
Block b)
Checks if it's allowed to rotate the block (this) by 90 degrees clockwise around b. |
boolean |
isTurnableCounterClockwise(de.unifreiburg.informatik.tetris.game.Field f,
Block b)
See isTurnableClockwise. |
boolean |
move(de.unifreiburg.informatik.tetris.game.Field f,
CartPt coords)
Moves the block. |
(package private) void |
moveDown(int y)
Moves the block y lines down without any check. |
boolean |
turnClockwise(de.unifreiburg.informatik.tetris.game.Field f,
Block b)
Turns the block (this) clockwise by 90 degree around the parameter b, if this is possible. |
boolean |
turnCounterClockwise(de.unifreiburg.informatik.tetris.game.Field f,
Block b)
See turnClockwise. |
void |
unsavemove(CartPt that)
This method is used to move the turnpoints. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Block(CartPt coords, java.awt.Color c)
coords
- the coordinates of the blockc
- the colorpublic Block(int x, int y, java.awt.Color c)
x
- the x-coordinatey
- the y-coordinatec
- the colorMethod Detail |
---|
public boolean isFree(CartPt coords)
coords
- the coordinates to look at
public boolean isFree(BlockList bl)
bl
- the blocklist to check.
public void draw(java.awt.Graphics g, int blocksize, int gap)
g
- the graphic deviceblocksize
- the size of a block in pixelgap
- the size of the gap in pixelpublic void draw(java.awt.Graphics g, int blocksize, int gap, boolean turnpoint)
g
- the graphic deviceblocksize
- the size of blocks in pixelgap
- the size of the gap in pixelturnpoint
- indicates if the block is a a normal block or not.public boolean move(de.unifreiburg.informatik.tetris.game.Field f, CartPt coords)
f
- the field with the blocklist to check.coords
- the offset
public boolean isMoveable(de.unifreiburg.informatik.tetris.game.Field f, CartPt coords)
f
- the field.coords
- the offset
public boolean isTurnableClockwise(de.unifreiburg.informatik.tetris.game.Field f, Block b)
f
- the fieldb
- the center of rotation
public boolean isTurnableCounterClockwise(de.unifreiburg.informatik.tetris.game.Field f, Block b)
f
- b
-
public boolean turnCounterClockwise(de.unifreiburg.informatik.tetris.game.Field f, Block b)
f
- b
-
public boolean turnClockwise(de.unifreiburg.informatik.tetris.game.Field f, Block b)
f
- the fieldb
- the center of roation
int getY()
void moveDown(int y)
y
- number of linespublic void unsavemove(CartPt that)
that
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |