Computer Science Canada

Multiple Keystroke Values

Author:  Prince Pwn [ Mon Jun 18, 2007 12:26 pm ]
Post subject:  Multiple Keystroke Values

How am I able to allow multiple keystrokes at the same time. For example, in the blow program I want to be able to hold DOWN and RIGHT to move in a downright position, so I need the value for DOWN and RIGHT.

Applet

Source Code.

Author:  rizzix [ Mon Jun 18, 2007 3:49 pm ]
Post subject:  RE:Multiple Keystroke Values

Haha! Yes.. lets just say its not possible Smile AWT/Swing was not designed for games, and they will not work the way you want for most games.

What you want is a polling mechanism not an IoC event handling mechanism. So, java game programmers have created a new api to resolve these issues: JInput (which also supports game controller/joysticks etc...)

You might have to do some reading to learn how to use it. You might even have to restructure your code to use it (..or maybe not). But it will be worth the effort. Smile


: