public void Update(double playerSpeed, boolean pointPassed) {

        //the following all increase the speed as a key is pressed
        // Calculating speed for moving up 
       
            if (playerSpeed == -1) {
                speedY = -2;
            } else if (playerSpeed == -2) {
                speedY = -4;
            } else if (playerSpeed == -3) {
                speedY = -4;
            } else if (playerSpeed == -4) {
                speedY = playerSpeed / 3;
            } else if (playerSpeed == -5) {
                speedY = -4 / 2;
            } 
            
            if (pointPassed == true){
                speedY = speedY * 2;
            }
        

        // Calculating speed for moving down.
       
//            if (playerSpeed <= TOP_SPEED * 0.5 / 2) {
//                speedY += speedAccelerating;
//            } else {
//                speedY -= speedStopping;
//            }
       
            // Calculating speed for moving or stopping to the left.
//        if (Canvas.keyboardKeyState(KeyEvent.VK_A)) {
//            speedX -= speedAccelerating;
//        } else if (speedX < 0) {
//            speedX += speedStopping;
//        }

        
        // Calculating speed for moving or stopping to the right.
//        if (Canvas.keyboardKeyState(KeyEvent.VK_D)) {
//            speedX += speedAccelerating;
//        } //if no keys are being press slow the car
//        else if (speedX > 0) {
//            speedX -= speedStopping;
//        }

        // Moves the car.
        x += speedX;
        y += speedY;
    }