public void keyReleased(KeyEvent e){
            if (e.getKeyCode() == KeyEvent.VK_LEFT){
                leftPressed = false;
            }
            if (e.getKeyCode() == KeyEvent.VK_RIGHT){
                rightPressed = false;
            }
        }