|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--uwcse.sim.PacThing
The basis for every object in the PacMan simulation. Every object has an x,y position and knows about its world.
| Field Summary | |
protected boolean |
alive
A flag representing the life state of this object. |
protected static java.util.Random |
rand
|
protected WorldModel |
world
|
protected int |
x
|
protected int |
y
|
| Constructor Summary | |
PacThing(WorldModel wm,
int x,
int y)
Create a new PacThing with the given properties. |
|
| Method Summary | |
abstract void |
action()
Subclass responsibility. |
void |
checkNeighbors()
Call interact on all neighbors. |
abstract void |
displayOn(uwcse.graphics.GWindow g)
Subclass responsibility. |
int |
getX()
Answer the x position. |
int |
getY()
Answer the y position. |
void |
interact(PacThing t)
Interact with another PacThing. |
boolean |
isAlive()
Answer the alive flag state. |
void |
kill()
Set the alive flag to false. |
java.lang.String |
toString()
Answer a nice textual representation. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected static java.util.Random rand
protected int x
protected int y
protected WorldModel world
protected boolean alive
| Constructor Detail |
public PacThing(WorldModel wm,
int x,
int y)
| Method Detail |
public int getX()
getX in interface Thingpublic int getY()
getY in interface Thingpublic abstract void action()
action in interface Thingpublic abstract void displayOn(uwcse.graphics.GWindow g)
displayOn in interface Thingpublic boolean isAlive()
isAlive in interface Thingpublic void kill()
public void interact(PacThing t)
public void checkNeighbors()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||