|
Breakout Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object breakout.BasicBrick breakout.HitpointsBrick
Example of Brick subclassing. This subclass of BasicBrick keeps track of a certain number of "hit points," and takes that many hits before it dies.
Field Summary |
Fields inherited from class breakout.BasicBrick |
location, size |
Constructor Summary | |
HitpointsBrick(int width,
int height)
Creates a new HitpointsBrick with the specified dimensions. |
Method Summary | |
boolean |
hit(BreakoutComponent bc)
Determines whether this HitpointsBrick has been hit enough times yet to die. |
void |
paint(java.awt.Graphics g)
Paints this HitpointsBrick. |
Methods inherited from class breakout.BasicBrick |
getLocation, getShape, getSize, setLocation, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HitpointsBrick(int width, int height)
width
- The intended width of the HitpointsBrick.height
- The intended height of the HitpointsBrick.Method Detail |
public boolean hit(BreakoutComponent bc)
hit
in interface BreakoutComponent
hit
in class BasicBrick
bc
- Rebounding/BreakoutComponent that hit this HitpointsBrick.
true
if we died; false
otherwise.public void paint(java.awt.Graphics g)
paint
in interface BreakoutComponent
paint
in class BasicBrick
g
- Graphics object for this ball's coordinate frame(ie, already located where we are).
|
Breakout Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |