com.jeffpalm.eggtris
Class Brick

java.lang.Object
  extended by com.jeffpalm.eggtris.Brick

public class Brick
extends java.lang.Object

The class is the building block for a Shape in Eggtris. To create one you pass in a color and size, this is all done by Shape, so there should be no need to call on this class outide of Shape. (except from possbily Board)

Since:
10.23.1998
Author:
Jeffrey Palm
See Also:
#eggtris.Shape, #eggtris.Board

Field Summary
protected  java.awt.Color color
          The color, defaults to Color.green.
protected  boolean locked
          Whether this Brick is free to move.
protected  int size
          Size of this Brick, defaults to 0.
protected  int x
          X position, defaults to 0.
protected  int y
          Y position, defaults to 0.
 
Constructor Summary
Brick(java.awt.Color color, int x, int y, int size)
          Instatiates a new Brick, initially it is free to move (!locked).
 
Method Summary
 void draw(java.awt.Graphics g)
          Draw this on the passed in Grahics context.
 void lock(Board board)
          Locks this brick (says it cannot move anymore) and puts this on the Board passed in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

color

protected java.awt.Color color
The color, defaults to Color.green.


x

protected int x
X position, defaults to 0.


y

protected int y
Y position, defaults to 0.


size

protected int size
Size of this Brick, defaults to 0.


locked

protected boolean locked
Whether this Brick is free to move. It becomes locked when someone calls lock(), but this should only be done by Shape it givesItBricksTo.

See Also:
#eggtris.Shape.givesItsBricksTo
Constructor Detail

Brick

public Brick(java.awt.Color color,
             int x,
             int y,
             int size)
Instatiates a new Brick, initially it is free to move (!locked).

Parameters:
color - Sets the color of this Brick.
x - Sets the x position.
y - Sets the y postion.
size - Sets the size, both height and width.
Method Detail

draw

public void draw(java.awt.Graphics g)
Draw this on the passed in Grahics context. Right now it just draws a fill3DRect() from the java.awt.Graphics class.

Parameters:
g - Graphics context on which to draw.

lock

public void lock(Board board)
Locks this brick (says it cannot move anymore) and puts this on the Board passed in.

Parameters:
board - Board on which to lock and put this.
See Also:
eggtris.Board