title: How to progress game to next level
body: <p>For my project I am designing a game that has three levels, each set out as an array. Upon completing each level, the game should automatically progress to the next level. I currently have it progressing from the 1st to 2nd level, but upon completing level 2, it simply reloads levels 2 again. My teacher says I should be using a variable to determine my current level, and incrementing it as I progress to the next level, which I am doing, so I'm unsure of why the game is stuck on level 2. He mentioned I should be using a static variable but I don't understand how that differs from what I'm doing currently.</p>
  <pre><code>{
      private char[][] level1 = {
          {'#', '#', '#', '#', ' ', ' ', ' ', ' ', ' ', ' '},
          {'#', ' ', '|', '#', ' ', ' ', ' ', ' ', ' ', ' '},
          {'#', ' ', ' ', '#', '#', '#', ' ', ' ', ' ', ' '},
          {'#', ' ', '@', ' ', ' ', '#', ' ', ' ', ' ', ' '},
          {'#', ' ', ' ', '$', ' ', '#', ' ', ' ', ' ', ' '},
          {'#', ' ', ' ', '#', '#', '#', ' ', ' ', ' ', ' '},
          {'#', '#', '#', '#', ' ', ' ', ' ', ' ', ' ', ' '}
      };
      
      private char[][] level2 = {
          {'#', '#', '#', '#', '#', ' ', ' ', ' ', ' '},
          {'#', '@', ' ', ' ', '#', ' ', ' ', ' ', ' '},
          {'#', ' ', '$', '$', '#', ' ', '#', '#', '#'},
          {'#', ' ', '$', ' ', '#', ' ', '#', '|', '#'},
          {'#', '#', '#', ' ', '#', '#', '#', '|', '#'},
          {' ', '#', '#', ' ', ' ', ' ', ' ', '|', '#'},
          {' ', '#', ' ', ' ', ' ', '#', ' ', ' ', '#'},
          {' ', '#', ' ', ' ', ' ', '#', '#', '#', '#'},
          {' ', '#', '#', '#', '#', '#', ' ', ' ', ' '},
      };
      
      private char[][] level3 = {
          {'#', '#', '#', '#', '#', '#', ' '},
          {'#', ' ', ' ', ' ', ' ', '#', ' '},
          {'#', ' ', '#', '@', ' ', '#', ' '},
          {'#', ' ', '$', '*', ' ', '#', ' '},
          {'#', ' ', '|', '*', ' ', '#', ' '},
          {'#', ' ', ' ', ' ', ' ', '#', ' '},
          {'#', '#', '#', '#', '#', '#', ' '},
      };
  
  public void act() {
  \\game code here
  
  if (testLevelComplete() == true) {
              levelComplete();   
          }
          
      }
     
      
      public void levelComplete()
      {
          int currentLevel = 0;
          currentLevel = currentLevel + 1;
          showWarning(&quot;Level Complete! Current level is &quot; + currentLevel);
          if (currentLevel == 1) {
              loadLevel(level1);
          } else {
          if (currentLevel == 2) {
              loadLevel(level2);
          } else {
           if (currentLevel == 3) {
              loadLevel(level3);
          } else {
          if (currentLevel &gt; 3) {
              showWarning(&quot;Level Complete! No more levels.&quot;);
          }}}}
          
          
      }
      
  }```
  </code></pre>