|
|||||||
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 Thing
public int getY()
getY
in interface Thing
public abstract void action()
action
in interface Thing
public abstract void displayOn(uwcse.graphics.GWindow g)
displayOn
in interface Thing
public boolean isAlive()
isAlive
in interface Thing
public 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 |