title: changing value in gameloop
body: <p>I have a variable <code>tail</code>. I set a value for this variable when creating constructor. And I have a <code>changeTail()</code> method which changes tail periodically by 10 pixels (increases 10 pixels and then decreases 10 pixels). 
  This method is called in <code>update</code> method so this is continuous. </p>
  
  <p>I have another method <code>speedUp()</code> which when score increases by 10 it speeds up player. To get the scores current value this is also called in <code>update</code> method.
  So, when I want to speed up game I also want to make tail longer. So I set a new value for tail using <code>speedUp()</code>. </p>
  
  <p>But the problem is, because of <code>speedUp()</code> being called in the <code>update</code> method it keeps setting the same value for <code>tail</code> and now <code>tail</code> does not change like it used to do before speed up.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class Game{
     float tail; 
     boolean increasing;  
     int score;  
  
     public Game(){
      tail = 60;
      increasing = false;
      score = 0;
     }
  
     public void changeTail(){
       if(increasing){
         tail += 1;
         if(tail &gt;= 60){
           increasing = false;
         }
       }else{
         tail -= 1;
         if(tail &lt;=50){
           increasing = true;
         }
       }    
     }
  
     public void speedUp(){
  
       if(score &gt;= 20){
        //player speed up
        tail = 70;
       }
  
     }
  
     public void update(){
       tailChange();
       speedUp();
     }
  
  }
  </code></pre>