4

I have an actor on a stage and though hit, and touchdown are being called, touchup and touchdragged aren't. Any ideas on what is wrong?

............
   stage = new Stage(0, 0, true);
   Gdx.input.setInputProcessor(stage);
...........

   @Override
   public Actor hit(float arg_x, float arg_y) {
      if ((arg_x > this.location.x) && (arg_x < (this.location.x + 40)) && (arg_y >     this.location.y) &&    (arg_y < (this.location.y + 40))) {
            Gdx.app.log("Tile", "hit char = " + this.GetLetter());
            return this;
         }
      return null;
   }

   @Override
   public boolean touchDown(float arg_x, float arg_y, int arg2) {
      Gdx.app.log("Tile", "down char = " + this.GetLetter());
      return false;
   }

   @Override
   public void touchDragged(float arg_x, float arg_y, int arg2) {
      Gdx.app.log("Tile", "tile dragged");
   }

   @Override
   public void touchUp(float arg_x, float arg_y, int arg2) {
      Gdx.app.log("Tile", "touchUp");
   }
tshepang
  • 12,111
  • 21
  • 91
  • 136
cleerline
  • 451
  • 1
  • 4
  • 9

1 Answers1

9

I found the answer on another forum.

  public boolean touchDown(float arg_x, float arg_y, int arg2) {
      Gdx.app.log("Tile", "down char = " + this.GetLetter());
      return false;
  }

should be

  public boolean touchDown(float arg_x, float arg_y, int arg2) {
      Gdx.app.log("Tile", "down char = " + this.GetLetter());
      return true;
  }

that is, it should return true rather than false. then the other methods will be called at the appropriate times.

P.T.
  • 24,557
  • 7
  • 64
  • 95
cleerline
  • 451
  • 1
  • 4
  • 9