Example #1
0
 public void playCarOnWall2() {
   try {
     car_wall2.play(SettingsScreen.getSFXPourcentage());
   } catch (NullPointerException e1) {
     car_wall2.play(0.75f);
   }
 }
Example #2
0
  public void checkpointCheck(int num) {

    if (num == 5) { // Checks if the car is on the last checkpoint

      if (currentCheckpoints.contains(0, true)
          && currentCheckpoints.contains(1, true)
          && currentCheckpoints.contains(2, true)
          && currentCheckpoints.contains(3, true)
          && currentCheckpoints.contains(4, true)) { // Checks if car has gone on every checkpoint

        lapCounter++; // If true, Add 1 to counter

        try {
          car_lap_complete.play(
              SettingsScreen
                  .getSFXPourcentage()); // Plays sound to indicate that the lap is complete
        } catch (NullPointerException e1) {
          car_lap_complete.play(0.75f);
        }
        currentCheckpoints.clear(); // Clear the list of checkpoint

      } else {
        System.out.println("Missed one or more checkpoints");
      }

    } else {
      if (!currentCheckpoints.contains(
          num, true)) { // Checks if the list already has the checkpoint
        currentCheckpoints.add(num); // If not, it adds it
      }
    }
  }
Example #3
0
  public void playCarOnTireSound() {

    try {
      car_Tire.play(SettingsScreen.getSFXPourcentage());
    } catch (NullPointerException e1) {
      car_Tire.play(0.75f);
    }
  }
Example #4
0
  public void addFuelArea(FuelAreaType item) {
    fuelAreas.add(item);

    try {
      car_going_on_fuel.play(SettingsScreen.getSFXPourcentage());
    } catch (NullPointerException e1) {
      car_going_on_fuel.play(0.75f);
    }
    loopedCar_fueling = false;
    updateFuel();
  }
Example #5
0
  public void addFuel() {
    if (this.getFuelTank() <= this.getmaxFuelCapacity()) {
      if (!loopedCar_fueling) {
        try {
          car_fueling.loop(SettingsScreen.getSFXPourcentage());
        } catch (NullPointerException e1) {
          car_fueling.loop(0.75f);
        }
        loopedCar_fueling = true;
      }

      this.setFuelTank(fuelTank + 1 / 6f);
    }
  }