|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.games.game.tetris.shape.AbstractShape
public abstract class AbstractShape
This class represents a Shape in tetris.
Constructor Summary | |
---|---|
AbstractShape()
|
|
AbstractShape(AbstractShape other)
|
Method Summary | |
---|---|
int |
countCellsInRow(int y)
Count all the Blocks that are in the given row |
TetrisBlock |
getBlock(int x,
int y)
|
List<TetrisBlock> |
getBlocks()
Get a list of all the TetrisBlocks for this shape |
List<TetrisBlock> |
getBottomBlocks()
|
TetrisBlock |
getBottomMostBlock()
Get the bottom most block in this shape |
TetrisBlock |
getBottomMostBlock(int x)
Return the lowest block in a specific column |
abstract AbstractShape |
getClone()
Create a cloned copy of the current object and return it. |
int |
getCurrentOrientation()
|
List<TetrisBlock> |
getLeftBlocks()
|
TetrisBlock |
getLeftMostBlock()
Get the left most block in this shape |
TetrisBlock |
getLeftMostBlock(int y)
Get the left most block in this shape for the given row |
TetrisBlock |
getRightMostBlock()
Get the right most block in this shape |
TetrisBlock |
getStaticBlock()
Each shape has one block that never changes position when it rotates. |
TetrisBlock |
getTopMostBlock()
Get the top most block in this shape |
boolean |
isInCell(int x,
int y)
Check if there are any Blocks in the specified cell |
protected void |
moveBlock(TetrisBlock block,
int amX,
int amY)
Move a specific block in this shape |
void |
moveShapeX(int amX)
Move the shape on the X axes |
void |
moveShapeY(int amY)
Move the shape on the Y axes |
abstract void |
rotate()
Rotate the shape to its next possible orientation |
boolean |
rotate(int AmRotations)
Rotate this shape for the specified amount of times |
void |
setShapeTopGrid()
Set this shape at the top of the grid |
boolean |
update(double currentSpeed,
GridGameState state)
attempt to move each block in shape down if collides before successfull move dont change pos and return false if moves but lands on bottom or above other block return false else return true |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractShape()
public AbstractShape(AbstractShape other)
Method Detail |
---|
public boolean update(double currentSpeed, GridGameState state)
currentSpeed
- state
-
public abstract AbstractShape getClone()
getClone
in interface Cloneable
Object.clone()
public abstract void rotate()
public boolean rotate(int AmRotations)
AmRotations
- the amount of Rotations to do
protected void moveBlock(TetrisBlock block, int amX, int amY)
Block
- the block to moveamX
- The amount to move on the X axesamY
- The amount to move on the Y axespublic void moveShapeX(int amX)
amX
- The amount to move on the X axespublic void moveShapeY(int amY)
amY
- The amount ot move on the Y axespublic List<TetrisBlock> getBlocks()
public TetrisBlock getStaticBlock()
public TetrisBlock getLeftMostBlock()
public TetrisBlock getLeftMostBlock(int y)
y
- The specified row to look atpublic List<TetrisBlock> getLeftBlocks()
public TetrisBlock getRightMostBlock()
public TetrisBlock getBottomMostBlock()
public TetrisBlock getBottomMostBlock(int x)
x
- The given column to search in
public List<TetrisBlock> getBottomBlocks()
public TetrisBlock getTopMostBlock()
public void setShapeTopGrid()
public int countCellsInRow(int y)
y
- the given row
public boolean isInCell(int x, int y)
x
- the X coordy
- the Y coord
public TetrisBlock getBlock(int x, int y)
public int getCurrentOrientation()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |