Bouncing ball code in c language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Bouncing ball code in c language

moveable ball in output

26th Nov 2017, 1:06 PM
Alam Shaikh
1 Answer
+ 3
I know how to make it but that's out dated . For making a bouncing ball animation in c++ you need to include the graphics.h library and then you need to use the function : circle(x,y,FILL); To create a ball and then put it inside a loop to make it bounce or you can even use recursion to make it much easier and efficient. Set two variables for x and y for the position of the ball. create a box using the function : rectangle(from_x,from_y,to_x,to_y); and set a proper width . Then use the algorithm of the bouncing ball.
26th Nov 2017, 1:32 PM
RZK 022
RZK 022 - avatar