anchor.diff:  = jMonkeyEngine 3 Tutorial (4) - Hello Update Loop
  -:author: 
  -:revnumber: 
  +:author:
  +:revnumber:
   :revdate: 2016/03/17 20:48
   :keywords: documentation, state, states, intro, beginner, control, loop
   :relfileprefix: ../../
  
positive.code: 
  == Conclusion
  
  Now you are listening to the update loop, “the heart beat of the game, and you can add all kinds of action to it. 
  
  The next thing the game needs is some __inter__action! Continue learning how to <<jme3/beginner/hello_input_system#,respond to user input>>.
  
  
negative.code:     @Override
      public void simpleUpdate(float tpf) {
          // make the player rotate:
          player.rotate(0, 2*tpf, 0);
      }
  }
  ----
  
  Build and run the file: You see a constantly rotating cube.
  
  
  == Understanding the Code
  
  Compared to our previous code samples you note that the player Geometry is now a class field. This is because we want the update loop to be able to access and transform this Geometry. As usual, we initialize the player object in the `simpleInitApp()` method.
  
  Now have a closer look at the `simpleUpdate()` method – this is the update loop.
  
  *  The `player.rotate(0, 2*tpf, 0);` line changes the rotation of the player object.
  *  We use the `tpf` variable ("`time per frame`") to time this action depending on the current frames per second rate. This simply means that the cube rotates with the same speed on fast and slow machines, and the game remains playable.
  *  When the game runs, the rotate() code is executed again and again.
  
  
  == Using the Update Loop
  
  A rotating object is just a simple example. In the update loop, you typically have many tests and trigger various game actions. This is where you update score and health points, check for collisions, make enemies calculate their next move, roll the dice whether a trap has been set off, play random ambient sounds, and much more.
  
  *  The `simpleUpdate()` method starts running after the `simpleInitApp()` method has initialized the scene graph and state variables.
  *  JME3 executes everything in the `simpleUpdate()` method repeatedly, as fast as possible.
  ..  Use the loop to poll the game state and then initiate actions.
  ..  Use the loop to trigger reactions and update the game state.
  ..  Use the loop wisely, because having too many calls in the loop also slows down the game.
  
  