title: LibGDX game: Check if button is touched when touchDown is called
body: <p>I am currently making a libGDX game for Android devices. I want to have a method which calls a function when touchDown is called but not when the button has been clicked. This is because I am setting a target for a turret and it should not rotate when the button is clicked.</p>
  
  <p>The code I have at the moment is</p>
  
  <pre><code>@Override
  public boolean touchDown(int screenX, int screenY, int pointer, int button) {
      if (state != STATE.GAMEOVERLOST &amp;&amp; state != STATE.PAUSED
              &amp;&amp; state != STATE.EXITMENU &amp;&amp; !slowButton.isOver()
              &amp;&amp; !pauseButton.isPressed())
          turret.setTargetAngle(screenX, screenY);
      return true;
  }
  </code></pre>
  
  <p>This overrides the function in the InputProcessor class my class implements.</p>
  
  <p>This code works:</p>
  
  <pre><code>@Override
  public boolean touchDragged(int screenX, int screenY, int pointer) {
      if (state != STATE.GAMEOVERLOST &amp;&amp; state != STATE.PAUSED
              &amp;&amp; state != STATE.EXITMENU &amp;&amp; !slowButton.isPressed()
              &amp;&amp; !pauseButton.isPressed())
          turret.setTargetAngle(screenX, screenY);
      return true;
  }
  </code></pre>
  
  <p>The fact that touchDragged works but touchDown does not indicates that the button does not get marked as 'pressed' until after the first instance.</p>
  
  <p>I have also tried using Button.isOver() instead of Button.isPressed() but this still does not work as expected.</p>
  
  <p>Anyone got any tips?</p>