New-Empty-Python-Project-Base icon indicating copy to clipboard operation
New-Empty-Python-Project-Base copied to clipboard

I've added a Pygame script for a bouncing ball animation.

Open nagdeepanjan opened this issue 8 months ago • 0 comments

This script, bouncing_ball.py, creates a simple graphical animation:

  • A ball moves and bounces off the edges of the Pygame window.
  • Two green triangles representing trees are displayed on either side of the screen.

Features:

  • Initializes Pygame and sets up an 800x600 display.
  • Defines a Ball class to handle position, movement, and drawing of the ball.
  • Includes a draw_tree function to render simple triangular trees.
  • The main game loop updates ball position, handles bouncing off screen edges, draws trees and the ball, and controls the frame rate to 60 FPS.

nagdeepanjan avatar May 21 '25 00:05 nagdeepanjan