title: Need to have a method constantly being called
body: <p>I am making Flappy Bird in JavaFX and I have created a method to tell the score. I have tried using a timeline but if I make it call the method too often, it gets very glitchy and if I make it slower, the score increments wrongly. I need a way to have the score method constantly being called without making the game slow and glitchy.</p>
  
  <p>Here is the method for the score:</p>
  
  <pre><code>public class Score {
  
      static int score = 0;
      static boolean incrementScore = false;
  
      public static int ScoreCount() {
  
          for (int i = 0; i &lt; 100; i++) {
  
          if (FlappyBird.bottomPipes[i].getTranslateX() == Bird.birdView.getTranslateX())
          incrementScore = true;
  
          if (incrementScore)
          score++;
  
          incrementScore = false;
  
          System.out.println(score);
  
          }
          return score;
       }
  }
  </code></pre>
  
  <p>If anyone knows a good way to do this, please let me know. </p>
  
  <p>If you would like to run the program, it can be downloaded <a href="http://www.filedropper.com/flappybird_3" rel="nofollow noreferrer">here</a></p>