@ -32,7 +34,8 @@ int main(int argc, char** argv) {
ALLEGRO_COLORblack=al_map_rgba(0,0,0,255);
ALLEGRO_COLORblack=al_map_rgba(0,0,0,255);
ALLEGRO_COLORwhite=al_map_rgba(255,255,255,255);
ALLEGRO_COLORwhite=al_map_rgba(255,255,255,255);
ALLEGRO_EVENTevent;
ALLEGRO_EVENTevent;
boolrunning=true;
boolrunning=false;
srand(time(NULL));// Seed for RNG
floatwidth=25;// Width and height of paddles
floatwidth=25;// Width and height of paddles
floatheight=150;
floatheight=150;
@ -43,11 +46,14 @@ int main(int argc, char** argv) {
floatvelocity_1=0;// Vertical velocity of first paddle
floatvelocity_1=0;// Vertical velocity of first paddle
floatvelocity_2=0;// Vertical velocity of second paddle
floatvelocity_2=0;// Vertical velocity of second paddle
floatcirc_x=WIN_WIDTH/2;// Center coordinates of ball
floatcirc_x=25;// Center coordinates of ball
floatcirc_y=WIN_HEIGHT/2;
floatcirc_y=25;
floatcirc_rad=10;// Radius of ball
floatcirc_rad=15;// Radius of ball
floatcirc_vel_x=5;// Horizontal velocity of ball
floatball_speed=sqrt(72);// Pythagorean distance travelled by ball in one main-loop iteration
floatcirc_vel_y=0;// Vertical velocity of ball
floatcirc_vel_x=(float)(rand())/(float)(RAND_MAX/3)+4.0;// Horizontal velocity of ball (Randomly generated, 4 to 7) - borrowed from https://stackoverflow.com/a/13409133
printf("%f\n",circ_vel_x);
floatcirc_vel_y=sqrt(pow(ball_speed,2)-pow(circ_vel_x,2));// Vertical velocity of ball - Subtract X velocity from hypotenuse / ball_speed