@Override
 public void onBackKeyPressed() {
   this.clearUpdateHandlers();
   this.clearEntityModifiers();
   this.engine.clearUpdateHandlers();
   AudioManager.getInstance().stop();
   SceneManager.getInstance().unloadGameLevelScene();
 }
  private synchronized void restart() {
    if (this.isStarted) {
      this.isRestarting = true;
      this.isStarted = false;
      this.onRestartBegin();
      this.unregisterUpdateHandler(this.levelWinHandler);
      this.unregisterUpdateHandler(this.levelReaderHandler);

      AudioManager.getInstance().stop();
      this.player.resetBonus();
      this.playerTrail.hide();
      this.parallaxFactor = -10f;

      final Shape[] elements = this.levelElements.toArray(new Shape[this.levelElements.size()]);
      this.levelElements.clear();
      this.engine.runOnUpdateThread(
          new Runnable() {
            @Override
            public void run() {
              for (Shape element : elements) {
                PhysicsConnector physicsConnector =
                    BaseGameScene.this
                        .physicWorld
                        .getPhysicsConnectorManager()
                        .findPhysicsConnectorByShape(element);
                if (physicsConnector != null) {
                  Body body = physicsConnector.getBody();
                  body.setActive(false);
                  // The body will be destoyed by the unspwaner later
                  // BaseGameScene.this.physicWorld.unregisterPhysicsConnector(physicsConnector);
                  // BaseGameScene.this.physicWorld.destroyBody(body);
                }
                element.detachSelf();
              }
              BaseGameScene.this.registerUpdateHandler(
                  new TimerHandler(
                      1f,
                      new ITimerCallback() {
                        @Override
                        public void onTimePassed(final TimerHandler pTimerHandler) {
                          BaseGameScene.this.engine.unregisterUpdateHandler(pTimerHandler);
                          BaseGameScene.this.parallaxFactor = 1f;
                          BaseGameScene.this.player.resetMovements();
                          BaseGameScene.this.onRestartEnd();
                          BaseGameScene.this.isRestarting = false;
                          BaseGameScene.this.start();
                        }
                      }));
            }
          });
    }
  }