uwcse.sim
Class Monster

java.lang.Object
  |
  +--uwcse.sim.PacThing
        |
        +--uwcse.sim.MovingThing
              |
              +--uwcse.sim.Monster
All Implemented Interfaces:
Thing

class Monster
extends MovingThing

The monster moves around, hunting the Man object.


Field Summary
(package private)  Man pacMan
           
 
Fields inherited from class uwcse.sim.MovingThing
direction
 
Fields inherited from class uwcse.sim.PacThing
alive, rand, world, x, y
 
Constructor Summary
Monster(WorldModel wm, int x, int y, Man pacMan)
          For efficiency's sake, the Monster knows about the man in the simulation.
 
Method Summary
 void action()
          Moves about half the time.
 void displayOn(uwcse.graphics.GWindow g)
          Displays as a red oval.
 void interact(PacThing t)
          Kills the Man.
 
Methods inherited from class uwcse.sim.MovingThing
 
Methods inherited from class uwcse.sim.PacThing
checkNeighbors, getX, getY, isAlive, kill, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pacMan

Man pacMan
Constructor Detail

Monster

public Monster(WorldModel wm,
               int x,
               int y,
               Man pacMan)
For efficiency's sake, the Monster knows about the man in the simulation.
Method Detail

displayOn

public void displayOn(uwcse.graphics.GWindow g)
Displays as a red oval.
Overrides:
displayOn in class MovingThing

action

public void action()
Moves about half the time. When it moves, its goal is to minimize the x and y distance between it and the pacman.
Overrides:
action in class MovingThing

interact

public void interact(PacThing t)
Kills the Man.
Overrides:
interact in class MovingThing