@Override
    public void keyPressed(KeyEvent e) {
        //see what key it was
        keyPressed = (e.getKeyChar());
        switch (keyPressed) {
            case 'a'://if it was "a" and the game is still on, move left
                if (!gameOver && !levelWon && !levelFail) {
                    moveLeft = true;
                }
                break;
            case 'd'://if it was "d" and the game is still on, move right
                if (!gameOver && !levelWon && !levelFail) {
                    moveRight = true;
                }
                break;
            case 'w'://if it was "w" and the game is still on, move up
                if (!gameOver && !levelWon && !levelFail) {
                    moveUp = true;
                }
                break;
            case 's'://if it was "s" and the game is still on, move down
                if (!gameOver && !levelWon && !levelFail) {
                    moveDown = true;
                }
                break;
            case 'p'://if it was "p" pause or unpause the game depending if it was already paused or not
                if (pause == false && ppressed == false && gameStarted) {
                    pause = true;
                    ppressed = true;
                } else if (pause == true && ppressed == false && gameStarted) {
                    pause = false;
                    ppressed = true;
                }
                break;
            case 32://if it was space proced to the next page
                if (statsPage == true) {
                    statsPage = false;
                    lives = 3;
                    vaildName = false;
                    resetField();
                }
                if (gameOver == true) {
                    gameStarted = false;
                    gameOver = false;
                    statsPage = true;
                }
                cheatON = true;
                break;
            default:
                System.err.println("KEY NOT SUPPORTED");
                break;
        }
    }