|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jeffpalm.eggtris.MyShape
public abstract class MyShape
This is the acstract class for a block in Eggtris.
Each Shape will have its own constructor, but it should follow the format:
[ShapeName](int size, int x, int y)
eggtris.Square
,
eggtris.RightL
Field Summary | |
---|---|
protected Brick[] |
bricks
The array of Bricks. |
protected int |
size
The size of a block. |
protected int |
x
The x position on the Board. |
protected int |
y
The y position on the Board. |
Constructor Summary | |
---|---|
MyShape()
|
Method Summary | |
---|---|
void |
draw(java.awt.Graphics g)
Draws this shape on the passed in Graphics context. |
void |
givesItsBricksTo(Board board)
VERY IMPORTANT |
boolean |
moveDown(Board board)
COME BACK HERE TO CHANGE THE RATE OF DROP Move down one space on the board. |
boolean |
moveLeft(Board board)
Move left one space on the board. |
boolean |
moveRight(Board board)
Move right one space on the board, if it can. |
boolean |
moveUp(Board board)
Move up one space on the board. |
abstract boolean |
rotate(Board board)
Over-ride this method to give your Shape the ability to rotate. |
void |
setX(int x)
Sets the x coord. |
void |
setY(int y)
Sets the y coord. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Brick[] bricks
protected int x
protected int y
protected int size
Constructor Detail |
---|
public MyShape()
Method Detail |
---|
public abstract boolean rotate(Board board)
board
- Board on which to rotate.
public boolean moveRight(Board board)
Board
- on which the Shape it drawn.
public boolean moveUp(Board board)
Board
- on the Shape is drawn.
public boolean moveDown(Board board)
Board
- on which the Shape it drawn.
public boolean moveLeft(Board board)
Board
- on which the Shape it drawn.
public void draw(java.awt.Graphics g)
g
- Graphics context on which to draw itself.public void givesItsBricksTo(Board board)
Call from the contrlling Applet tell this block to give its bricks to the Boardo on which it is drawn (the one passed in). If you don't call it, this Shape will NOT become locked onto the board.
board
- Board on which this's Bricks will be locked.public void setX(int x)
x
- X position.public void setY(int y)
y
- Y position.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |