I make a game on LibGdx , tapping on the screen triggers the following method for a shot

 public void aim() { float x = Gdx.input.getX(); float y = Gdx.input.getY(); // получаю две переменный и дальше их уже использую. } 

The essence of the matter is, when I tap with one finger on the screen, a shot at this point occurs (the finger remains on the screen), then I tap another finger at another point, then the shot comes at the first point.

Can someone know how in LibGDX you can handle simultaneous clicks on the screen?

Tried to do with Stage and divide the screen into two equal parts in the form of Actor , nothing good happened either.

    1 answer 1

    By default, getX will return the first pointer to you, in order to read the following tapes you need to use the Gdx.input.getX(int index) method, i.e. for example for the second:

      float x = Gdx.input.getX(1); float y = Gdx.input.getY(1); 

    You can check whether the current pointer is pressed through Gdx.input.isTouched , and do a polling in a loop, however these are details.

    • Yes, it works, thanks! - Alexey