Exemplo n.º 1
0
 public void move(int distance, Direction direction, boolean useFuel) {
   switch (direction) {
     case UP:
       location.y -= distance;
       break;
     case DOWN:
       location.y += distance;
       break;
     case LEFT:
       location.x -= distance;
       break;
     case RIGHT:
       location.x += distance;
       break;
     default:
       assert false : "Bad direction: " + location;
   }
   if (useFuel) tank.useFuel(1);
 }
Exemplo n.º 2
0
 public void goToLocation() {
   location.x = storedLocation.x;
   location.y = storedLocation.y;
 }