1

I have used "CameraInputController" and "Touchpad" which is contained in a stage to move my camera, and move my character, respectively.

However, I have encountered a problem. I use InputMultiplexer like this to set both processors.

    InputMultiplexer multiplexer = new InputMultiplexer();
    multiplexer.addProcessor(camController);
    multiplexer.addProcessor(stage);

    Gdx.input.setInputProcessor(multiplexer);

Now the problem is when I move the touchPad, the camera also moves. That is annoying to the player.

Therefore I want a method to have different input processors in different parts of the screen.

Fish
  • 1,689
  • 1
  • 18
  • 28
  • I'm voting to close this question as off-topic because It belongs in Gamedev – MLProgrammer-CiM Apr 19 '15 at 23:15
  • 4
    @MLProgrammer-CiM There's nothing disallowing programming questions on SO simply because they are also related to games. If you look at the libgdx or unity3d tags, you might be surprised to see thousands of questions related to game development. – Tenfour04 Apr 19 '15 at 23:29

1 Answers1

3

I think it will solve by change the order of the InputAdapter.

multiplexer.addProcessor(stage);
multiplexer.addProcessor(camController);

Because the Stage will now be the first to handle the input events and if you return true the camController won't be handled after that. See InputMultiplexer Wiki for a little more Information.

Quallenmann
  • 323
  • 2
  • 8