|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface World encapsulates how BreakoutComponents and exterior entites interact with a game world.
WorldListener
,
BreakoutComponent
Field Summary | |
static int |
MAXX
maximum X value |
static int |
MAXY
maximum Y value |
static float |
SHAPE_PRECISION
This is the maximum distance between any two consecutive points in a shape describing a DefaultBreakoutComponent
(in units of pixels) |
Method Summary | |
void |
add(BreakoutComponent bc)
adds a component to the world |
void |
addMouseAware(BreakoutComponent bc)
adds a component to the world and adds it to the MouseListeners and MouseMotionListeners |
void |
addWorldListener(WorldListener wl)
adds the given listener to the list of objects to be informed of changes in the world state |
void |
ballLeft(Ball bc)
signal that the given ball has left the board for a better place (the other board). |
int |
getBallsLeft()
returns the number of balls left. |
BreakoutComponent |
intersects(BreakoutComponent bc)
tests to see if anything else in the world intersects with the given component. |
Iterator |
iterator()
returns an iterator over the elements of the World |
void |
killAll()
kills all components except the walls and empties the vector. |
boolean |
playing()
returns true if a game is in progress. |
void |
rebound(BreakoutComponent bc1,
BreakoutComponent bc2)
rebound causes the two entities to rebound off each other, mutating their DX and DY values. |
void |
removeAt(Point location)
removes the component at the given coordinates. |
void |
startPlaying()
indicate that game should start. |
Field Detail |
public static final int MAXX
public static final int MAXY
public static final float SHAPE_PRECISION
DefaultBreakoutComponent
(in units of pixels)
Method Detail |
public BreakoutComponent intersects(BreakoutComponent bc)
bc
- component to test
public void rebound(BreakoutComponent bc1, BreakoutComponent bc2)
bc1
- component to have reboundbc2
- component to have reboundpublic void add(BreakoutComponent bc)
bc
- component to add.public void addMouseAware(BreakoutComponent bc)
bc
- component to add
ClassCastException
- if argument doesn't implement the
required interfaces.public Iterator iterator()
public void removeAt(Point location)
location
- coordinates of component to be removed.public void ballLeft(Ball bc)
bc
- ball that has left. Ball is killed.public void killAll()
public void startPlaying()
public boolean playing()
public int getBallsLeft()
public void addWorldListener(WorldListener wl)
wl
- WorldListener to add.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |