Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm planning to make a simple soccerball app. When I attempt to drag the ball, I use the touchDragged() from InputProcessor to move the ball left or right. Next, while holding before releasing, I use the fling() from the GestureDetector to set the power. However, when I'm trying to set the input processor of both the implementing InputProcessor and the GestureDetector, it didn't work. Moreover, whenever the last time you set the input processor and that would be either the two of them. Why?

share|improve this question
up vote 2 down vote accepted

To be clear, you're calling:


twice? It just sets a global variable, so that's why only one sticks.

To support multiple input processors simultaneously, you want an InputMultiplexer. You can add multiple InputProcessor instances to the multiplexer and it will pass events to them in the order the processors were registered.

However, I think you'll still run into problems because both of your input processors are trying to "eat" the same input events (touch events). One of them will consume the events, leaving the other with nothing. Unless you can separate where on the screen each input processor owns (e.g., if the power-setting is a separate area of the screen from the soccer ball). Or, you could build your own multiplexer that knows which "mode" the game is in, and forwards events to the appropriate input processor. Its hard to say without more concrete information about your system.

share|improve this answer
It's either to set a flag or in one of the methods under InputProcessor, it has to be set to false. – David Dimalanta Mar 11 '13 at 1:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.