Showing posts with label algorithm for bouncing ball. Show all posts
Showing posts with label algorithm for bouncing ball. Show all posts

Algorithm - Bouncing ball - pygame

Algorithm - Bouncing ball 
  1.     Start the program
  2.     Set screen size and background color.
  3.    Set speed of moving ball.
  4.    Create a graphical window using set_mode()
  5.    Set caption
  6.     Load the ball image and create a rectangle area covering the image
  7.    Use blit() method to copy the pixel color of the ball to the screen
  8.     Set background color of screen and use flip() method to make all images visible.
  9.     Move the ball in specified speed.
  10.    If ball hits the edges of the screen reverse the direction. 
  11.    Create an infinite loop and Repeat steps 9 and 10 until user quits the program
  12.     Stop the program