public void keyPressed(KeyEvent e) {
        if (state == MUERTO) {
            if (e.getKeyCode() == KeyEvent.VK_SPACE) {
                restart = true;
            }
        } else if (state == VIVO && e.getKeyCode() == KeyEvent.VK_SPACE) {
            if (bird.getPosY() > 0) {
                salta = true;
            }
        }
        if (e.getKeyCode() == KeyEvent.VK_P) { //se pausa el juego
            if (state < 3) {
                state += PAUSA;
            } else if ((state & 4) != 0) {
                state -= PAUSA;
            }
        }
    }