libgdx Ontouch only once
libgdx, touch
Solution
You probably have this code in your `render()` method. This method is called continuously. And of course `Gdx.input.isTouched()` will return `true` as long as you keep the screen touched or the mouse button down.
If you want to track just the first event of "touch down", then you need to implement an `InputProcessor`. See this link for example code how to do so.
Problem
When I click my screen I need to execute code only once, but the code is executing a lot of times while the screen is not released. Here is my code: ``` if(Gdx.input.isTouched(0)){ gx = Gdx.input.getX(); gy = Gdx.input.getY(); for(int i=1; i<=7; i++){ d = (int) Math.sqrt(((gx-pomx[i])*(gx-pomx[i])) + ((gy-pomy[i])*(gy-pomy[i]))); if(d<r){ sestoagolnik_objekt.setRotation(stepen += 60); } } } ```