/**
  * The Heads Up Display. This is used for the user to see their current status in the game. This
  * HUD will display the number of bullets currently, how many lives the player has, the current
  * level, and how many turns of invincibility the player has.
  */
 public void setHUD() {
   HUD.removeAll();
   JLabel HUDLives = new JLabel("Lives: " + engine.getLife());
   JLabel HUDBullets = new JLabel("Bullets: " + engine.getBullets());
   JLabel HUDInv = new JLabel("Turns of invincibility: " + engine.getTurns());
   JLabel HUDLevel = new JLabel("Level: " + engine.getLevels());
   HUD.add(HUDLives, BorderLayout.PAGE_START);
   HUD.add(HUDBullets, BorderLayout.SOUTH);
   HUD.add(HUDInv, BorderLayout.CENTER);
   HUD.add(HUDLevel, BorderLayout.EAST);
   HUD.revalidate();
 }
  /**
   * Key events used in this method allow for the interaction of the game within it. This is done by
   * adding in a key listener into the JFrame in order to take input from the user.
   */
  @Override
  public void keyPressed(KeyEvent e) {
    boolean looking = false;
    // TODO Auto-generated method stub
    if (e.getKeyCode() == KeyEvent.VK_C) {
      JOptionPane.showMessageDialog(f, "DEBUG MODE ACTIVATED (CHEATER MODE ACTIVE MANG.)");
      engine.setReveal(true);
      looking = true;
      debugPaint(0);
    }
    if (e.getKeyCode() == KeyEvent.VK_H) {
      JOptionPane.showMessageDialog(f, "DEBUG MODE DEACTIVATED (HIDE SHAME MODE ACTIVE.)");
      engine.setReveal(false);
      looking = true;
      paint(0);
    }

    if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
      engine.movePlayer(4);
      if (engine.checkForPlayer()) {
        JOptionPane.showMessageDialog(f, "YOU WERE STABBED!!");
        if (engine.getLife() == 0) {
          JOptionPane.showMessageDialog(f, "0 LIVES! GAME OVER!!");
          JOptionPane.showMessageDialog(
              f,
              "LEVELS CLEARED: "
                  + (engine.getLevels() - 1)
                  + "\nBULLETS ON DEATH: "
                  + engine.getBullets()
                  + "\nENEMIES KILLED: "
                  + engine.getEnemiesKilled()
                  + "\nPOWERUPS OBTAINED: "
                  + engine.getPowerupsObtained(),
              "Score",
              JOptionPane.INFORMATION_MESSAGE);
          System.exit(0);
        }
        if (engine.isDebugging()) {
          debugPaint(0);
        } else {
          paint(0);
        }
      }
      engine.moveEnemy();
      if (engine.isDebugging()) {
        debugPaint(0);
      } else {
        paint(0);
      }
    } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
      engine.movePlayer(3);
      if (engine.checkForPlayer()) {
        JOptionPane.showMessageDialog(f, "YOU WERE STABBED!!");
        if (engine.getLife() == 0) {
          JOptionPane.showMessageDialog(f, "0 LIVES! GAME OVER!!");
          JOptionPane.showMessageDialog(
              f,
              "LEVELS CLEARED: "
                  + (engine.getLevels() - 1)
                  + "\nBULLETS ON DEATH: "
                  + engine.getBullets()
                  + "\nENEMIES KILLED: "
                  + engine.getEnemiesKilled()
                  + "\nPOWERUPS OBTAINED: "
                  + engine.getPowerupsObtained(),
              "Score",
              JOptionPane.INFORMATION_MESSAGE);
          System.exit(0);
        }
        if (engine.isDebugging()) {
          debugPaint(0);
        } else {
          paint(0);
        }
      }
      engine.moveEnemy();
      if (engine.isDebugging()) {
        debugPaint(0);
      } else {
        paint(0);
      }
    } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
      engine.movePlayer(2);
      if (engine.checkForPlayer()) {
        JOptionPane.showMessageDialog(f, "YOU WERE STABBED!!");
        if (engine.getLife() == 0) {
          JOptionPane.showMessageDialog(f, "0 LIVES! GAME OVER!!");
          JOptionPane.showMessageDialog(
              f,
              "LEVELS CLEARED: "
                  + (engine.getLevels() - 1)
                  + "\nBULLETS ON DEATH: "
                  + engine.getBullets()
                  + "\nENEMIES KILLED: "
                  + engine.getEnemiesKilled()
                  + "\nPOWERUPS OBTAINED: "
                  + engine.getPowerupsObtained(),
              "Score",
              JOptionPane.INFORMATION_MESSAGE);
          System.exit(0);
        }
        if (engine.isDebugging()) {
          debugPaint(0);
        } else {
          paint(0);
        }
      }
      engine.moveEnemy();
      if (engine.isDebugging()) {
        debugPaint(0);
      } else {
        paint(0);
      }
    } else if (e.getKeyCode() == KeyEvent.VK_UP) {
      engine.movePlayer(1);
      if (engine.checkForPlayer()) {
        JOptionPane.showMessageDialog(f, "YOU WERE STABBED!!");
        if (engine.getLife() == 0) {
          JOptionPane.showMessageDialog(f, "0 LIVES! GAME OVER!!");
          JOptionPane.showMessageDialog(
              f,
              "LEVELS CLEARED: "
                  + (engine.getLevels() - 1)
                  + "\nBULLETS ON DEATH: "
                  + engine.getBullets()
                  + "\nENEMIES KILLED: "
                  + engine.getEnemiesKilled()
                  + "\nPOWERUPS OBTAINED: "
                  + engine.getPowerupsObtained(),
              "Score",
              JOptionPane.INFORMATION_MESSAGE);
          System.exit(0);
        }
        if (engine.isDebugging()) {
          debugPaint(0);
        } else {
          paint(0);
        }
      }
      engine.moveEnemy();
      if (engine.isDebugging()) {
        debugPaint(0);
      } else {
        paint(0);
      }
    }

    if (e.getKeyCode() == KeyEvent.VK_4) {
      if (engine.look(4)) {
        JOptionPane.showMessageDialog(f, "NINJA SPOTTED", "WARNING", JOptionPane.ERROR_MESSAGE);
      }
      if (engine.isDebugging()) {
        debugPaint(0);
      } else {
        paint(4);
      }
      looking = true;
    } else if (e.getKeyCode() == KeyEvent.VK_3) {
      if (engine.look(3)) {
        JOptionPane.showMessageDialog(f, "NINJA SPOTTED", "WARNING", JOptionPane.ERROR_MESSAGE);
      }
      if (engine.isDebugging()) {
        debugPaint(0);
      } else {
        paint(3);
      }
      looking = true;
    } else if (e.getKeyCode() == KeyEvent.VK_2) {
      if (engine.look(2)) {
        JOptionPane.showMessageDialog(f, "NINJA SPOTTED", "WARNING", JOptionPane.ERROR_MESSAGE);
      }
      if (engine.isDebugging()) {
        debugPaint(0);
      } else {
        paint(2);
      }
      looking = true;
    } else if (e.getKeyCode() == KeyEvent.VK_1) {
      if (engine.look(1)) {
        JOptionPane.showMessageDialog(f, "NINJA SPOTTED", "WARNING", JOptionPane.ERROR_MESSAGE);
      }
      if (engine.isDebugging()) {
        debugPaint(0);
      } else {
        paint(1);
      }
      looking = true;
    }

    if (e.getKeyCode() == KeyEvent.VK_W) {
      looking = true;
      if (engine.getBullets() != 0) {
        JOptionPane.showMessageDialog(f, "BAM!!");
        JOptionPane.showMessageDialog(f, engine.shoot(1) + " NINJAS WERE REKT!!");
      } else {
        JOptionPane.showMessageDialog(f, "NO AMMUNITION!! ", "Warning", JOptionPane.ERROR_MESSAGE);
      }
    } else if (e.getKeyCode() == KeyEvent.VK_D) {
      looking = true;
      if (engine.getBullets() != 0) {
        JOptionPane.showMessageDialog(f, "BAM!!");
        JOptionPane.showMessageDialog(f, engine.shoot(4) + " NINJAS WERE REKT!!");
      } else {
        JOptionPane.showMessageDialog(f, "NO AMMUNITION!! ", "Warning", JOptionPane.ERROR_MESSAGE);
      }
    } else if (e.getKeyCode() == KeyEvent.VK_A) {
      looking = true;
      if (engine.getBullets() != 0) {
        JOptionPane.showMessageDialog(f, "BAM!!");
        JOptionPane.showMessageDialog(f, engine.shoot(3) + " NINJAS WERE REKT!!");
      } else {
        JOptionPane.showMessageDialog(f, "NO AMMUNITION!! ", "Warning", JOptionPane.ERROR_MESSAGE);
      }
    } else if (e.getKeyCode() == KeyEvent.VK_S) {
      looking = true;
      if (engine.getBullets() != 0) {
        JOptionPane.showMessageDialog(f, "BAM!!");
        JOptionPane.showMessageDialog(f, engine.shoot(2) + " NINJAS WERE REKT!!");
      } else {
        JOptionPane.showMessageDialog(f, "NO AMMUNITION!! ", "Warning", JOptionPane.ERROR_MESSAGE);
      }
    }

    if (engine.getCheckRoom()) {
      if (engine.getDocFound()) {
        JOptionPane.showMessageDialog(f, "DOCUMENT FOUND.");
        JOptionPane.showMessageDialog(f, "LEVEL CLEARED!!");
        engine.levelUp();
        if (engine.isDebugging()) {
          debugPaint(0);
        } else {
          paint(0);
        }
      } else {
        JOptionPane.showMessageDialog(f, "NOTHING FOUND IN THIS ROOM!!");
        engine.getCheckRoom(false);
      }
    }

    setHUD();
  }