Ball is thrown now after a set number of movements.  There is an error in the throwBall() function in setting the target of the ball though so it is being thrown in the wrong direction