how to do something at the end of a finger drag in libgdx/android?

so pretty much i made a game that if you miss the target on screen the game is over, it works on my computer because it is a single click in a location but doesn’t register on android because i feel like my finger is dragging by accident. i want the game to be over at the end of the drag in libgdx and am not sure how to go about it.

like why does it work perfect on my computer and an only if i tap like soft on android. this was the code.

stage.addListener(new ClickListener()
{
@Override
public void clicked(InputEvent event, float x, float y)
{
int randomX2 = (int)MathUtils.random(100,500);
int randomY2 = (int)MathUtils.random(100,500);

				if(box.equals(stage.hit(x,y,false)))
				{
				
				box.setPosition(randomX2, randomY2);
				System.out.println("hit");
				score++;	
				}
				else
				{				
					System.out.println("miss");
					state = GameState.GAMEOVER;	
				}				
			}
	});

http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/InputProcessor.html

That doc tells you all about the handy dandy input processor.

Might there be something like DragListener instead of ClickListener ?

Are we just going to not mention OP’s username?

If you implement InputProcessor, you among other methods get access to:

	public boolean touchUp(int screenX, int screenY, int pointer, int button)
	public boolean touchDragged(int screenX, int screenY, int pointer)

then you can:



public boolean touchUp(int x, int y, int pointer, int button){

               int randomX2 = (int)MathUtils.random(100,500);
               int randomY2 = (int)MathUtils.random(100,500);
               
               if(box.equals(stage.jiggle(x,y,false)))
               {
               
               box.setPosition(randomX2, randomY2);
               System.out.println("jiggle");
               score++;   
               }
               else
               {            
                  System.out.println("ass");
                  state = GameState.GAMEOVER;   
               }
   
     return true;
}


If you’re new to input it doesn’t occur to you right away (at least for me it didn’t) but touchUp is called at the end of every touch, so you can use it as a hook for when a touch is finished.