public void keyPressed() { if (keyCode == ESC || key == ESC) { key = 0; keyCode = 0; stateMachine.Pop(); } }