Ignore ESCAPE key & do other action?
in
Programming Questions
•
3 months ago
Under normal circumstances, the ESCAPE key exits the currently running Processing program. I'm making a game, and I want to use the ESCAPE key to allow a player to leave the game and transition into a menu. How can I get Processing to ignore the normal exit function for the ESCAPE key and instead allow me to do other things with it?
For example:
- void setup(){};
- void draw(){};
- void keyPressed(){
- if (keyCode == 27){
- // leave game
- // transition to menu
- };
- };
1