// Prevents overlapping of dodgeball throws
 private boolean allBallsOverLine() {
   for (Dodgeball dodgeball : getBallsInFlightList()) {
     if (dodgeball.isEnemyBall() && dodgeball.getCenterX() > getMyWidth() * .6) {
       return false;
     }
   }
   return true;
 }
  @Override
  public void step(double elapsedTime) {
    Random rand = new Random();
    if (getTimeRemaining() < 0 && getGameStarted()) {
      exitLevel("You got beat, you didn't defeat Goodman!!");
    }
    if (getGameStarted()) {
      getMyRoot().getChildren().remove(getTimerLabel());
      setTimeRemaining(getTimeRemaining() - elapsedTime);
      Label timerLabel = new Label(Long.toString(Math.round(getTimeRemaining() - elapsedTime)));
      timerLabel.setTextFill(Color.BLACK);
      timerLabel.setStyle("-fx-font-size: 4em;");
      timerLabel.setLayoutX(getMyWidth() / 2 - getMyWidth() * .04);
      timerLabel.setLayoutY(getMyHeight() * .15);
      setTimerLabel(timerLabel);
      getMyRoot().getChildren().add(getTimerLabel());
      if (myDodgeball == null && rand.nextInt(100) == 0) {

        myDodgeball =
            new Dodgeball(
                getMyWidth() * .45,
                getMyHeight() * 2 / 3,
                villainPlayerIV.getX(),
                villainPlayerIV.getY(),
                20,
                Color.RED,
                false,
                false);

        getBallsInFlightList().add(myDodgeball);
        getMyRoot().getChildren().add(myDodgeball);
      }
      if (tossBall()) {
        int highOrLow = rand.nextInt(3) * 20;
        Dodgeball newEnemyBall =
            new Dodgeball(
                villainPlayerIV.getX(),
                villainPlayerIV.getY(),
                getMyPlayerIV().getX(),
                getMyPlayerIV().getY() + highOrLow,
                20,
                Color.PURPLE,
                true,
                true);

        getBallsInFlightList().add(newEnemyBall);
        getMyRoot().getChildren().add(newEnemyBall);
      }
      Iterator<Dodgeball> iter = getBallsInFlightList().iterator();
      while (iter.hasNext()) {
        Dodgeball currBall = iter.next();

        if (currBall.isBeingThrown()) {
          if (!currBall.isEnemyBall()) {
            currBall.setCenterX(currBall.getCenterX() + villainPlayer.getMyTossSpeed());
            currBall.setCenterY(
                currBall.getCenterX() * currBall.getTrajectorySlope()
                    + currBall.getTrajectoryYIntercept());
            // check for collisions
            if (villainPlayerIV.getBoundsInParent().intersects(currBall.getBoundsInParent())) {
              int currLives = enemyLivesHBox.getChildren().size();
              getMyRoot().getChildren().removeAll(currBall, enemyLivesHBox);
              setEnemyLivesHBox(currLives - 1);
              getMyRoot().getChildren().add(getEnemyLivesHBox());
              iter.remove();
              myDodgeball = null;
              if (enemyLivesHBox.getChildren().size() == 0) {
                exitLevel("You won!!");
              }
            }
          } else {
            currBall.setCenterX(currBall.getCenterX() - villainPlayer.getMyTossSpeed());
            currBall.setCenterY(
                currBall.getCenterX() * currBall.getTrajectorySlope()
                    + currBall.getTrajectoryYIntercept());
            //                     check for collisions
            if (getMyPlayerIV().getBoundsInParent().intersects(currBall.getBoundsInParent())) {
              iter.remove();
              getMyRoot().getChildren().removeAll(currBall, getMyLivesHBox());

              setMyLivesHBox(getMyLivesHBox().getChildren().size() - 1);
              getMyRoot().getChildren().add(getMyLivesHBox());
              if (getMyLivesHBox().getChildren().size() == 0) {
                exitLevel("You got beat!!");
              }
            }
          }
          double currX = currBall.getCenterX();
          if (currX < 0) {
            iter.remove();
            getMyRoot().getChildren().remove(currBall);
          }
        }
      }
    }
  }