title: Java Applet, game loop runs fine the first time, and then when reset, updates at half the speed
body: <p>so for the game I'm creating I realized I mist have done something wrong with my gameLoop because the first time I play through my game it runs great, but the second time or anything after that, it slows down by about half. Even if I minimize the game (Because that stops the gameLoop, and then bringing it up again starts it back up) here is the gameLoop code:</p>
  
  <pre><code>public void gameLoop(){
  
          new Thread(){
              public void run() {
                  while(gameRunning){
                      try {
                          Thread.sleep(1000/60);
                      } catch (InterruptedException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                      if (tutorial){
                          updateBullet();
                          updatePlayer();
                          repaint();
                      } else {
                          updateEnemies();
                          updateBullet();
                          createEnemies();
                          updateParticles();
                          updatePlayer();
                          repaint();
                      }
  
                  }
                  repaint();
              }
          }.start();
  }
  </code></pre>
  
  <p>I start it for the first time in the init() just with </p>
  
  <pre><code>gameLoop();
  </code></pre>
  
  <p>And then I also have:</p>
  
  <pre><code>public void stop(){
      bg.stop();
      gameRunning = false;
  }
  public void start(){
      bg.start();
      gameRunning = true;
      gameLoop();
  
  }
  </code></pre>
  
  <p>And finally the playerUpdate also stops the loop with (The Thread inside of player is to allow for some effects to finish after the player dies):</p>
  
  <pre><code> public void updatePlayer(){
      if (player.isMovingLeft){
          player.x-=3;
      }
      if (player.isMovingRight){
          player.x+=3;
      }
      for (int j=0; j &lt; enemies.size(); j++){
          if (player.isAlive){
              if (enemies.get(j).x+19 &gt; player.x &amp;&amp; enemies.get(j).x &lt; player.x+40 &amp;&amp; enemies.get(j).y &gt; player.y  &amp;&amp; enemies.get(j).y &lt; player.y+40) {
                  enemies.remove(j);
                  j--;
                  explode.setFramePosition(0);
                  explode.start();
                  for (int k = 0; k &lt;21; k++){
                      addParticle(player.x+20,player.y+20,2);
                  }
                  new Thread(){
                      public void run() {
                          try {
                              Thread.sleep(2000);
                              gameRunning = false;
                          } catch (InterruptedException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                          }
                      }
                  }.start();
  
                  player.isAlive = false;
                  break;
  
              }
          }
      }
  }
  </code></pre>
  
  <p>And then it is restarted with in the keyPressed event:</p>
  
  <pre><code>if (!gameRunning){
          if (arg0.getKeyCode() == KeyEvent.VK_ENTER){
              enemies.clear();
              bullets.clear();
              particles.clear();
              score = 0;
              player.x = 200;
              player.isMovingLeft = false;
              player.isMovingRight = false;
              player.isAlive = (true);
  
              gameRunning = true;
              gameLoop();
          }
      }
  </code></pre>
  
  <p>So why is it that whenever the loop is stopped and started again, it runs at half the speed? Thanks!</p>