Libgdx touchup and touchdragged not called but landing

I have an actor on stage, and although the hits and the touchdown are called, touchup and touchdragged are not. Any ideas on what's 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"); } 
+4
source share
1 answer

I found the answer in another forum.

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

it 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 , not false . then other methods will be called at the appropriate time points.

+9
source

Source: https://habr.com/ru/post/1403277/


All Articles