floatball_y=ball.pos.y;/* Y co-ordinate of ball */
floatball_y=ball.pos.y;/* Y co-ordinate of ball */
floatoffset=paddle_mid_y-ball_y;/* Subtracting the ball coordinate will give us a value between -paddle_mid_y (represents bottom of paddle) and +paddle_mid_y (represents top of paddle) */
floatoffset=paddle_mid_y-ball_y;/* Subtracting the ball coordinate will give us a value between -paddle_mid_y (represents bottom of paddle) and +paddle_mid_y (represents top of paddle) */
offset/=(paddle.getRect().GetHeight()/2.0);/* Normalize the value, by dividing it by its maximum magnitude. It is now a value between -1 and 1. */
offset/=(paddle.getRect().GetHeight());/* Normalize the value, by dividing it by its maximum magnitude. It is now a value between -1 and 1. */
TraceLog(LOG_INFO,"Offset: %.2f\n",offset);
// offset *= -1; /* Reverse the sign of the offset, so that -1 represents the top, and 1 represents the bottom */
offset*=0.8+(float)(std::rand())/(float)(RAND_MAX/(1.2-0.8));// Generate a random float from 0.8 to 1.2
floatbounce_angle=offset*BASE_BOUNCE_RAD;/* Calculate the actual bounce angle from the base bounce angle. */
floatbounce_angle=offset*BASE_BOUNCE_RAD;/* Calculate the actual bounce angle from the base bounce angle. */