title: Phaser - How to check for sprite moving between two other sprites?
body: <p>I'm trying to check if one sprite is passing the line between two other sprites. I tried to check if the sprite is overlapping a Phaser.Line with:</p>
  
  <pre><code>this.lineGreenToRed = new Phaser.Line(this.ballGreen.x, this.ballGreen.y, this.ballRed.x, this.ballRed.y);
  
  this.checkPassed = this.lineGreenToRed.pointOnLine(this.ballBlue.position.x, this.ballBlue.position.y);
  if (this.checkPassed) {
      console.log('GreenToRed passed');
      //counter++;
  };
  console.log(this.checkPassed);
  </code></pre>
  
  <p>Looking into the console this counts up the false events whenever my sprite is not on/over the line. Moving it over the line sometimes gives me the true event, but not always. It looks like the frames change too fast to detect it. Overlap check on Lines does not seem to be possible neither.</p>
  
  <p>I have also tried with:</p>
  
  <pre><code>this.GreenToRedArray = this.lineGreenToRed.coordinatesOnLine();
  </code></pre>
  
  <p>and in update():</p>
  
  <pre><code>this.GreenToRedArray.forEach(this.checkPoint, this);
  </code></pre>
  
  <p>and then:</p>
  
  <pre><code>checkPoint : function(element){
        if (this.ballBlue.position.x == element[0] &amp;&amp; this.ballBlue.position.y == element[1]){
          console.log('GreenToRed passed');
          this.score++;
          console.log(this.score);
          this.scoreText.setText(this.score);
      }
  },
  </code></pre>
  
  <p>This works as long as I move quite slow over the line, but as soon as things move a little faster, it does not catch it anymore.</p>
  
  <p>Any hint on how I could check if one sprite is moving over the line between two other sprites?</p>
  
  <p>Think of it as two balls marking kind of a goal and a third ball being shoot through between these two.</p>
  
  <p>Thanks a lot for any help.</p>