Ejemplo n.º 1
0
 /** Moves the creature */
 @Override
 public void move() {
   if (direction == Direction.DIRECTION_WEST) {
     pos = new Position(pos.getX() - speed, pos.getY());
   } else {
     pos = new Position(pos.getX() + speed, pos.getY());
   }
 }
Ejemplo n.º 2
0
 /**
  * Returns the polygon for this creature.
  *
  * @return the polygon
  */
 public Polygon getPolygon() {
   int[] xs = {pos.getX(), pos.getX() + 31, pos.getX() + 31, pos.getX()};
   int[] ys = {pos.getY(), pos.getY(), pos.getY() + 31, pos.getY() + 31};
   return new Polygon(xs, ys, 4);
 }