protected void shutdown() {
    super.shutdown();

    backgroundMusic.release(audioMgr);
    splatSound.release(audioMgr);
    resource1.unload();
    audioMgr.shutdown();

    if (gameClient != null) {
      gameClient.sendByeMessage();
      try {
        gameClient.shutdown();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    display.close();
  }
  public void initGame() {
    try {
      this.gameClient =
          new GameClient(InetAddress.getByName(serverAddr), serverPort, serverProtocol, this);
    } catch (UnknownHostException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

    if (gameClient != null) {
      gameClient.sendJoinMessage();
    }

    display = getDisplaySystem();
    eventMgr = EventManager.getInstance();

    display.setTitle("Super Duper Gem Collector X");

    renderer = getDisplaySystem().getRenderer();

    if (scriptCheck) {
      initPhysics();
      initSkyBox();
      initTerrain();
      initGameObjects();
      initPlayers();
      initScript();
      initInput();
      initEvents();
      initAudio();
    } else {
      initPhysics();
      initSkyBox();
      initTerrain();
      initGameObjects();
      initPlayers();
      initWorldAxis();
      initInput();
      initEvents();
      initAudio();
    }
    // HUD
    player1ScoreString = new HUDString("Score= " + player1Score);
    player1ScoreString.setLocation(0.9, 0.05);
    player1ScoreString.setColor(Color.GREEN);
    camera1.addToHUD(player1ScoreString);

    player1HPString = new HUDString("HP: " + player1HP);
    camera1.addToHUD(player1HPString);

    player1GameOverString = new HUDString("");
    player1GameOverString.setLocation(.5, .5);
    camera1.addToHUD(player1GameOverString);
  }
  public void update(float elapsedTimeMS) {
    super.update(elapsedTimeMS);
    player1.updateAnimation(elapsedTimeMS);

    if (!isGPOn) {
      cam1Controller.update(elapsedTimeMS);
    } else {
      cam1GPController.update(elapsedTimeMS);
    }

    if (gameClient != null) {
      gameClient.sendUpdate(getPlayerPosition());
      gameClient.processPackets();
    }
    physicsEngine.update(20.0f);
    Matrix3D mat;
    Vector3D translateVec;

    for (SceneNode s : getGameWorld()) {

      if (s.getPhysicsObject() != null) {
        if (s.getWorldBound().intersects(player1.getWorldBound())
            && (s.getName().equals("src/Models/car.obj")
                || s.getName().equals("src/Models/truck.obj"))) {
          playerHit = true;

          s.setLocalTranslation(new Matrix3D());
          s.translate(0, 10, 0);
        }
        if (s.getName().equals(player1.getName())) {
          mat = s.getLocalTranslation();
          translateVec = mat.getCol(3);
          s.getLocalTranslation().setCol(3, translateVec);

        } else {
          mat = new Matrix3D(s.getPhysicsObject().getTransform());
          translateVec = mat.getCol(3);
          s.getLocalTranslation().setCol(3, translateVec);
        }
      } else if (s instanceof TriMesh
          && s.getWorldBound().intersects(player1.getWorldBound())
          && (s.getName().equals("src/Models/car.obj")
              || s.getName().equals("src/Models/truck.obj"))) {
        playerHit = true;
      }
    }
    player1ScoreString.setText("Score = " + player1Score);
    player1HPString.setText("HP: " + player1HP);

    Matrix3D camTranslation = new Matrix3D();
    camTranslation.translate(
        camera1.getLocation().getX(), camera1.getLocation().getY(), camera1.getLocation().getZ());
    skybox.setLocalTranslation(camTranslation);

    if (playerHit) {
      splatSound.play(100, false);
      player1.translate(133f, 13f, 123f);
      playerHit = false;
    }

    if (gameOver) {
      player1GameOverString.setText("LOOOOOOOSER!");
    } else if (!player1Won) {
      if (checkWin()) {
        gameClient.sendWonMessage();
        player1Won = true;
        player1GameOverString.setText("WINNER!");
      }
    }
  }