public void keyPressed(KeyEvent e) { s.keysPressed[e.getKeyCode()] = true; } public void keyReleased(KeyEvent e) { s.keysPressed[e.getKeyCode()] = false; }
The problem is in the Main_Loop I have a processCommands() method that processes the keys that are true. Now the problem with this is that if you press a key faster then the screen updates, it will turn it to false before the Main_Loop has a chance to to process the command. The result is that the game won't process the key press... The way around this is to not have a keyReleased() method, but rather in my processKeys() have it turn the variables false after the processing of it. However, this in turns brings up other problems: if I want to scroll my map I have to press the key over and over...
The only way around this that I could think of was to have the keyReleased() method only turn select keyCodes to false. This would be the Directional keys... so that scrolling works nice, and yet everything else like it is supposed to.
Also I've been running out of logical keyboard shortcuts to different dialogs:
S: Send Message
C: View Sprite_Cache
N: New Connection
P: Pause
L: Log
A: Actor Dialog(for attaching new actors to the map)
M: Menu
SHIFT+UP: Change Tile one shade lighter
SHIFT+DOWN: Change Tile one shade Darker
CONTROL+UP: Change Tile hight + 1
CoNTROL+DOWN: Change Tile height - 1
SPACE+(UP|DOWN|LEFT|RIGHT): Move Camera
UP|DOWN|LEFT|RIGHT: Move Cursor
ENTER: Activate Event
I was thinking of changing the Pause to Escape, so that I could have P as Paint (the tile)... small things [smile]
LINE COUNT: 2235
And then the function can, if it needs to, unpress the key so that it won't be called again when the functions are called again in the main loop's s.DoKeyPresses(). But yeah, to each his own.