title: In LibGDX with Scene2D, how can I continuously walk to the right when a button is pressed?
body: <p>I have the following piece of code in my <code>InputAdapter</code>:</p>
  
  <pre><code>...
  @Override
  public boolean keyDown (int keycode) {
      if (keycode == Keybindings.KEY_RIGHT) this.player.right();
      return super.keyDown(keycode);
  }
  
  @Override
  public boolean keyUp (int keycode) {
      if (keycode == Keybindings.KEY_RIGHT) this.player.stopMovingRight();
      return super.keyUp(keycode);
  }
  ...
  </code></pre>
  
  <p>And my <code>PlayerActor</code> class is responsible for <code>right()</code> and <code>stopMovingRight()</code>:</p>
  
  <pre><code>...
  public void right () {
      this.right = true;
      this.setX(this.getX() + 1f);
  }
  
  public void stopMovingRight () {
      this.right = false;
  }
  ...
  </code></pre>
  
  <p>Now, when I run the application, my <code>PlayerActor</code> moves just 1 unit when I press the <code>KEY_RIGHT</code> key (the 'D' key on the keyboard). The problem is that I instead want to <em>continuously</em> move the <code>PlayerActor</code> while I am pressing down the key.</p>
  
  <p>Situation now:</p>
  
  <ul>
  <li>Hold down key -> move (just) 1 unit to the right</li>
  <li>Let go of key -> nothing happens</li>
  </ul>
  
  <p>Desired situation:</p>
  
  <ul>
  <li>Hold down key -> move 1 unit to the right continuously</li>
  <li>Let go of key -> stop moving to the right</li>
  </ul>
  
  <p>I would love to hear your thoughts on this matter, cheers!</p>