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 have two Actors on my stage in libgdx and and both have a InputListener. I override the touchDown method and it works fine. My Problem is that when I press my Actor Z and a second later Actor Y only Actor Z fires a touchDown event.

How do I solve this problem? Or how did you solve the problem when you have some input actors/sprites on your screen and you wanted that the player can jump and move to the right at the same time?

share|improve this question
Place them in the same input methods? Have booleans that can be accessed by both classes. The booleans get set in your input class – Savlon Apr 13 '13 at 3:06
I dont unterstand. I will try to explain it better. I have an Actor arrow_left and i've added to him a new InputListener like this: arrow_left.addListener(new InputListener() { here I override my needed methods }); The Problem is when I've pressed my arrow_left he reacts (I set a boolean LEFT to true) but when I try to press a second later my "shoot" Actor, the actor arrow_left stopps and the shoot actor fires an event. But i want that i can still walk to the left as I'm shooting. Hope that helps:) – Tom Brown Apr 13 '13 at 11:28
Ok so create an "Input" class... In this class you take in a "Main Game" variable where you add the "addKeyListener(mainGame) in the constructor and then use that input class to control all of your actors... – Savlon Apr 13 '13 at 12:46
Create a Boolean for "moveLeft" in your mainGame class and set that Boolean to true when the left arrow key is pressed and when released set it to false. Then you can either check for the Boolean in your actor classes or your main class and in your update method move your actors to their respective positions etc... This will result in both actors being moved at the same time and not stopping for each other.. If you need me to give you some code to help explain this topic just let me know and ill post it. – Savlon Apr 13 '13 at 12:46
Right, I made a boolean in my mainGame and when the Actor is pressed I set it to true and by release to false. KeyEvents from the Keyboard works all fine. I have just trouble with the Touch. Some Code would really help. Btw how can I contact you? Im new here. – Tom Brown Apr 13 '13 at 15:23

Your Answer


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

Browse other questions tagged or ask your own question.