public void keyPressed(KeyEvent e) {
    int keyPressed = e.getKeyCode();
    switch (keyPressed) {
      case KeyEvent.VK_SPACE:
        // System.out.println("SPACE");
        g1.jump();
        break;

      case KeyEvent.VK_UP:
        if (g1.isOrientationUp() == false) {
          // System.out.println("Flipping from facing down to facing up");
          g1.flip();
        } else {
          // System.out.println("cannot flip. Alradying oriented up.");

        }
        break;

      case KeyEvent.VK_DOWN:
        if (g1.isOrientationUp() == true) {
          // System.out.println("Flipping from facing up to facing down");
          g1.flip();
        } else {
          // System.out.println("cannot flip. Alradying oriented down.");

        }
        break;
    }
  }
 public static void checkGameOver() {
   if (g1.getLives() == 0) {
     System.out.println("Game Over!");
     g1.setAlive(false);
   }
 }
  public static void main(String[] args) {
    GooseRunner01 game = new GooseRunner01();
    g1 = new Goose(game);
    map = new GooseRunnerMap(game);

    time = 0;
    counter = 1;

    // TOP_TO_BOTTOM_Y_LOC - DEFAULT_HEIGHT
    // createsObstacles
    // moves obstacles
    // creates bumps
    GooseRunnerMapBump b1 = new GooseRunnerMapBump(400, bottomBumpYs, game);
    GooseRunnerMapBump b2 = new GooseRunnerMapBump(400 - textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b3 = new GooseRunnerMapBump(400 - 2 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b4 = new GooseRunnerMapBump(400 - 3 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b5 = new GooseRunnerMapBump(400 - 4 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b6 = new GooseRunnerMapBump(400 - 5 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b7 = new GooseRunnerMapBump(400 - 6 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b8 = new GooseRunnerMapBump(400 + 1 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b9 = new GooseRunnerMapBump(400 + 2 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b10 = new GooseRunnerMapBump(400 + 3 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b11 = new GooseRunnerMapBump(400 + 4 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b12 = new GooseRunnerMapBump(400 + 5 * textureSpacing, bottomBumpYs, game);
    GooseRunnerMapBump b13 = new GooseRunnerMapBump(400 + 6 * textureSpacing, bottomBumpYs, game);

    GooseRunnerMapBump t1 = new GooseRunnerMapBump(400, topBumpYs, game);
    GooseRunnerMapBump t2 = new GooseRunnerMapBump(400 - textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t3 = new GooseRunnerMapBump(400 - 2 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t4 = new GooseRunnerMapBump(400 - 3 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t5 = new GooseRunnerMapBump(400 - 4 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t6 = new GooseRunnerMapBump(400 - 5 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t7 = new GooseRunnerMapBump(400 - 6 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t8 = new GooseRunnerMapBump(400 + 1 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t9 = new GooseRunnerMapBump(400 + 2 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t10 = new GooseRunnerMapBump(400 + 3 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t11 = new GooseRunnerMapBump(400 + 4 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t12 = new GooseRunnerMapBump(400 + 5 * textureSpacing, topBumpYs, game);
    GooseRunnerMapBump t13 = new GooseRunnerMapBump(400 + 6 * textureSpacing, topBumpYs, game);

    GooseObstacle o = new GooseObstacle(game, bottomObstacleY); // comes in at 0
    GooseObstacle o1 =
        new GooseObstacle(game, topObstacleY, 2000, 6000, 800, DEFAULT_HEIGHT); // comes in at 2000
    GooseObstacle o2 =
        new GooseObstacle(game, bottomObstacleY, 2500, 2500, 20, DEFAULT_HEIGHT); // comes in at 500
    GooseObstacle o3 =
        new GooseObstacle(
            game, bottomObstacleY, 4000, 4000, 500, DEFAULT_HEIGHT); // comes in at 500
    GooseObstacle o4 =
        new GooseObstacle(
            game, bottomObstacleY, 800, 1600, DEFAULT_WIDTH, DEFAULT_HEIGHT); // comes in at 500

    GooseObstacle o5 =
        new GooseObstacle(
            game, topObstacleY, 1300, 1900, DEFAULT_WIDTH, DEFAULT_HEIGHT); // comes in at 500
    GooseObstacle o6 =
        new GooseObstacle(
            game, topObstacleY, 1400, 1700, DEFAULT_WIDTH, DEFAULT_HEIGHT); // comes in at 500
    GooseObstacle o7 =
        new GooseObstacle(
            game, topObstacleY, 500, 1200, DEFAULT_WIDTH, DEFAULT_HEIGHT); // comes in at 500
    GooseObstacle o8 =
        new GooseObstacle(
            game, bottomObstacleY, 1450, 800, DEFAULT_WIDTH, DEFAULT_HEIGHT); // comes in at 500
    GooseObstacle o9 =
        new GooseObstacle(
            game, bottomObstacleY, 3000, 3000, 6000, DEFAULT_HEIGHT); // comes in at 500
    obstaclesArrayList.add(o);
    obstaclesArrayList.add(o1);
    obstaclesArrayList.add(o2);
    obstaclesArrayList.add(o3);
    obstaclesArrayList.add(o4);
    obstaclesArrayList.add(o5);
    obstaclesArrayList.add(o6);
    obstaclesArrayList.add(o7);
    obstaclesArrayList.add(o8);
    obstaclesArrayList.add(o9);
    int speedCounter = 1;
    // topObstacleY

    // plays game
    while (g1.isAlive() == true) {
      checkIfHit();
      checkGameOver();
      // to be used for score
      time++;
      if (time > 10) {
        time = 0;
        System.out.println("Score: " + counter);
        counter++;
      }

      if (counter > SPEED_CHANGE * speedCounter) {
        System.out.println("----------Speed Increase");
        speed = speed + 3;
        DELAY -= 3;
        speedCounter++;
      }

      // moves obstacles
      o.move();
      o1.move();
      o2.move();
      o3.move();
      o4.move();
      o5.move();
      o6.move();
      o7.move();
      o8.move();
      o9.move();

      // moves bumps
      b1.move();
      b2.move();
      b3.move();
      b4.move();
      b5.move();
      b6.move();
      b7.move();
      b8.move();
      b9.move();
      b10.move();
      b11.move();
      b12.move();
      b13.move();

      t1.move();
      t2.move();
      t3.move();
      t4.move();
      t5.move();
      t6.move();
      t7.move();
      t8.move();
      t9.move();
      t10.move();
      t11.move();
      t12.move();
      t13.move();

      delay();
    }
  }
  public static void checkIfHit() { // this is wrong
    if (counter >= contactTime + MIN_TIME_BETWEEN_HITS) {
      for (int i = 0; i < obstaclesArrayList.size(); i++) {
        // System.out.println("xloc: " + obstaclesArrayList.get(i).getxLocation() );
        if (obstaclesArrayList.get(i).getxLocation() >= DEFAULT_X - 0.5 * DEFAULT_DIMENSION
            && obstaclesArrayList.get(i).getxLocation() <= DEFAULT_X + 0.5 * DEFAULT_DIMENSION) {
          if (obstaclesArrayList.get(i).getyLocation() == bottomObstacleY
              && obstaclesArrayList.get(i).getyLocation() <= g1.getyLoc() + DEFAULT_DIMENSION) {
            // System.out.println("bottom contact");

            g1.setLives(g1.getLives() - 1); // lower lives by one
            contactTime = counter;

            // System.out.println("Number of lives: " + g1.getLives());
            switch (g1.getLives()) {
              case 2:
                g1.setColor(lives2);
                break;
              case 1:
                g1.setColor(lives1);
            }
            return;

          } else if (obstaclesArrayList.get(i).getyLocation() == topObstacleY
              && obstaclesArrayList.get(i).getyLocation() >= g1.getyLoc() - DEFAULT_DIMENSION) {
            // System.out.println("top contact");

            g1.setLives(g1.getLives() - 1); // lower lives by one
            contactTime = counter;

            // System.out.println("Number of lives: " + g1.getLives());
            switch (g1.getLives()) {
              case 2:
                g1.setColor(lives2);
                break;
              case 1:
                g1.setColor(lives1);
            }
            return;
          }
        }
      }
    }
  }