I displayed the image in the center of the screen using libgdx. If I scroll left, the image should move to the left, and if I lay the correct image, it should move to the right.
Subsequent left clicks should move the image to the left. The same thing should happen for the right. I have used GestureListener.
This works to some extent in the sense that if I scroll left, the first image moves left. But after that, if I try to slip to the right, the image still moves to the left.
So how do I overcome this in libgdx ??
class MyGestureListener implements GestureListener {
@Override
public boolean fling(float arg0, float arg1, int arg2) {
if(arg0>0)
iX += 20;
else
iX-=20;
System.out.println("Hello..............."+iX);
return true;
}
Gdx.input.setInputProcessor(new GestureDetector(0.0f, 0.0f,0.0f, 5f,new MyGestureListener()));
batch.draw(splashTexture, iX, iY);
source
share