Problem with KeyListener

Hello,

please help: Within my main class (extension from JFrame) I added a KeyListener. I only set flags within the methods of the KeyListeners.
The flags are checked in my game loop which runs in a different thread.
The problem I have is as following: Let’s say I hold pressed the fire key and my player keeps firing, but if I press an additional key, e.g. to move my player, the firing stops.

Hope this is understandable?

How can I avoid this? I tried to run the KeyListener in it’s own thread but it didn’t work as desired.

When are you resetting your flags to false?

Could we see the code?

Kev

I’ve found it. Thanks for the hint about setting the flags. There were some lines I should have removed when I changed the structure of the game.

Thx.