Example #1
0
 public void act() {
   move(speed);
   if (this.getRotation() == Direction.EAST.getCarRotation() && isAtEdge()) {
     setLocation(0, getY());
   } else if (this.getRotation() == Direction.WEST.getCarRotation() && isAtEdge()) {
     setLocation(TrafficWorld.WIDTH, getY());
   } else if (this.getRotation() == Direction.SOUTH.getCarRotation() && isAtEdge()) {
     setLocation(getX(), 0);
   } else if (this.getRotation() == Direction.NORTH.getCarRotation() && isAtEdge()) {
     setLocation(getX(), TrafficWorld.HEIGHT);
   }
 }
 public boolean bottomIsFloor() {
   int x = calcBottomX(bHeight), y = calcBottomY(bHeight);
   Direction btDir = Direction.NORTH.rotate(-bHeight - 2);
   return isFloor(x + btDir.toX(), bHeight, y + btDir.toY());
 }