Beginning of the moveBall function
Purpose of moveBall (see Listing 4):
Listing 4. Beginning of the moveBall function.
void moveBall(){ //Save current location of ball. tempX = x; tempY = y; switch(dir){ case 0: //Direction is northwest. if((x <= radius) || (y <= radius)){ dir = rand() % 4;; }else{ //No collision, set new // location for the ball --x; --y; }//end else break; |