uwcse.sim
Class MovingThing
java.lang.Object
|
+--uwcse.sim.PacThing
|
+--uwcse.sim.MovingThing
- All Implemented Interfaces:
- Thing
- Direct Known Subclasses:
- Man, Monster
- abstract class MovingThing
- extends PacThing
The basis for every moving object in the PacMan simulation. Moving
objects may not travel through walls, therefore, before they move
they must test cells in the direction they are heading to assure that
they are free of walls.
Field Summary |
(package private) Offset |
direction
Default direction is to the EAST. |
Method Summary |
(package private) static void |
()
|
void |
action()
Basically checks that the cells in the given direction are clear
and if so, moves a step in that direction. |
abstract void |
displayOn(uwcse.graphics.GWindow g)
Subclass responsibility. |
abstract void |
interact(PacThing t)
Subclass responsibility. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
direction
Offset direction
- Default direction is to the EAST.
MovingThing
public MovingThing(WorldModel wm,
int x,
int y)
- Create a new moving thing.
static void ()
displayOn
public abstract void displayOn(uwcse.graphics.GWindow g)
- Subclass responsibility.
- Overrides:
displayOn
in class PacThing
action
public void action()
- Basically checks that the cells in the given direction are clear
and if so, moves a step in that direction.
- Overrides:
action
in class PacThing
interact
public abstract void interact(PacThing t)
- Subclass responsibility.
- Overrides:
interact
in class PacThing