I'm working on a game, and I would want the player to be able to increase the speed by double tapping the screen, my problem: Since the player moves by pressing the screen once (you press to the left to move left, and right to move right) will there be a delay for the program to see if the screen was pressed once or twice, or will the player first start by going normal speed, then speed up if it detects another tap? This is how my movement looks atm:
touchPos.set(Gdx.input.getX() - 42, Gdx.input.getY() + 19, 0);
camera.unproject(touchPos);
if (Gdx.input.isTouched()) {
if (player.getX() > touchPos.x + 16) {
player.setPosition(player.getX() - (speed * Gdx.graphics.getDeltaTime()), player.getY() + (130 * Gdx.graphics.getDeltaTime()));
} else if (player.getX() < touchPos.x - 16) {
player.setPosition(player.getX() + (speed * Gdx.graphics.getDeltaTime()), player.getY() + (130 * Gdx.graphics.getDeltaTime()));
}
And this works just fine, but how should I implement so the player can speed up with a simple gesture? Thoughts? (let me know if I need to elaborate, or post more code)