I am pretty new to libgdx, and I'm trying to use gestures to move a ball across the screen when a flinging motion is made on the screen. I've made this gesture listener:
class MyGestureListener implements GestureListener {
public boolean fling(float velocityX, float velocityY, int button) {
if (Math.abs(velocityY) > 0) {
ballPositionY -= velocityY*Gdx.graphics.getDeltaTime();
}
return false;
}
}
I initialized a detector for the listener in create() and used the following for the ball image in render():
batch.draw(ballImage, ballPositionX, ballPositionY);
The ball moves on fling in proportion to the velocity of the fling. However, it jumps across the screen from its original position to the final position, but I want it to have continuous motion (i.e. see it move across the screen rather than just jump from one point to another). How would I do this? Is fling appropriate for this task, or would you use something else? I am guessing this might have something to do with the frame rate but am not sure.
Thanks in advance!