Maximum simultaneous keypresses
Author |
Message |
Drahcir
|
Posted: Sun May 17, 2009 9:49 pm Post subject: Maximum simultaneous keypresses |
|
|
I've been writing a two-player shooting game in Java that takes in keyboard buttons with keyPressed and keyReleased, but I've run into a problem.
Apparently only 3 or 4 keys can be pressed down at the same time, before it starts not taking any more key input. The only way to do more commands is to let go of one of the keys. Is there any way to solve this problem? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
[Gandalf]
|
Posted: Sun May 17, 2009 10:21 pm Post subject: RE:Maximum simultaneous keypresses |
|
|
I'm not sure, but I believe there is some limitation simply in the amount of keys an average keyboard registers at any time. So, this problem may or may not have anything to do with Java. Perhaps that will provide more motivation to let your game run over a network? |
|
|
|
|
|
zylum
|
Posted: Mon May 18, 2009 1:15 am Post subject: RE:Maximum simultaneous keypresses |
|
|
Have a boolean array for the keys.. In the pressed handler, set the appropriate index to true and in the release handler, set it to false. Then simply use this array to see which keys are pressed.. |
|
|
|
|
|
r691175002
|
Posted: Tue May 19, 2009 1:06 am Post subject: Re: Maximum simultaneous keypresses |
|
|
This is the limitation of your keyboard, not Java. |
|
|
|
|
|
|
|