I'm doing a little game, but I need to detetct more than one key. KeyListener doesn't seem very useful at this.
Is there a way to detect more than one key at a time.
Thanks in advance!
I'm doing a little game, but I need to detetct more than one key. KeyListener doesn't seem very useful at this.
Is there a way to detect more than one key at a time.
Thanks in advance!
When programming a game you usually have a game loop. in the loop you render each frame after checking for things You want
Meaning you can receive the press events and save them in an array or a map and then Chek this array for all pressed keys Before rendering the next frame.
The release events will remove thibgs from the pressed keys map
You can also ignore the game loop and just check and update the pressed keys map when you get a new event (but it depends on the kind of game you are trying to build )