title: LibGDX - Ending a Level and breaking out of Render()
body: <p>The basic idea of the game is to collect all the items in a room in order to proceed to the next. Not very original I know... When the items are all collected, a screen will be displayed stating "Level Complete" and then after a few seconds the next level will be reloaded. The problem I am having is that when I land on the last item, and the check "have all the items been collected?" rule is satisfied the game suddenly freezes, well starts to shake actually. The player sprite is frozen in place, as is the item, and the game can no longer be interacted with. I can only assume that the game is getting trapped inside the render() method and is not escaping, or is satisfying the same condition over again. </p>
  
  <p>Does anyone have any ideas on how to break out of the main render() method correctly to traverse to a new screen?</p>
  
  <p>In my main render() method I have a call to another method which checks the gamestate, ie, have all of the items been collected in the room...</p>
  
  <pre><code>render() {
  
      ... code ...
      checkGameState()
  }
  </code></pre>
  
  <p>And then checkGameState() looks as follows:</p>
  
  <pre><code>public void checkGameState() 
  {
  
      //If the player has collected all of the items on a level then do something
      //if(stats.getItemsCollected() == stats.getTotalItems()) {
          //reset some stuff
          stats.resetItems();
          stats.incLevel();
  
          //show the intermediate screen or menu screen
  
          //load the next level
          showLevelCompleteScreen();
  
  
          //
  
      }
  }
  </code></pre>
  
  <p>The ShowLevelCompleteScreen() method simply attempts to switch screens as follows:</p>
  
  <pre><code>public void showLevelComplete()
  {
      game.setScreen(SuperBlockMan.LevelComplete);
  }
  </code></pre>