As most of you know i am working on my 8-bit style game and need help figuring out how to implement something. I want to implement an easter egg by having the user type in a certain word. However since i am creating a game, using a textfield would look out of place. So the person would need to enter the code while the game is running, in other words by pressing the correct keyboard letters to spell the secret code. public void keyPressed(KeyEvent e) only accepts on key at a time. I could use booleans for each key, but then it would require a lot of nested ifs not to mention it would decrease performance alot:
1 2 3 4 5 6 7
| if(KeyJ == true) { if(KeyA== true) { ... } } |
If someone could give me an elegent solution it would be greatly appreciated.
Sincerely,
8BitOoze