Skip to content

Simple Pygame project simulating a bouncing ball with customizable physics and smooth animations. Ideal for beginners learning game development in Python.

License

Notifications You must be signed in to change notification settings

fahadelahikhan/Bouncing-Ball-Pygame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bouncing Ball Pygame 🎮

Python Version License

A Python implementation of a bouncing ball game using the Pygame library.

📜 About

This project implements a simple physics-based bouncing ball game where players control a platform to bounce a ball and prevent it from falling off the screen. It's an excellent example of basic game development principles and physics simulation in Python using Pygame.

✨ Features

  • Physics-based ball movement with realistic bouncing
  • Player-controlled platform with arrow key input
  • Score tracking and level progression
  • Lives system with game over conditions
  • Color-changing platform for visual feedback

🚀 Quick Start

Installation

  1. Clone the repository:

    git clone https://github.com/fahadelahikhan/Bouncing-Ball-Pygame.git
    cd Bouncing-Ball-Pygame
  2. Install required dependencies:

    pip install pygame
  3. Run the game:

    python main.py

Basic Usage

# The game is controlled via keyboard inputs
# Use the LEFT and RIGHT arrow keys to move the platform
# Prevent the ball from falling off the bottom of the screen
# Each successful bounce increases your score

Example Game Session

# The ball starts at the center of the screen with random velocity
ball_pos = [400, 300]
ball_speed = [3.0, 3.5]

# The platform starts at the bottom center of the screen
platform_pos = [350, 560]

# As the player bounces the ball, the score increases
# When the score reaches 10, the player advances to level 2
current_level = 2

📖 How It Works

The game implements basic physics principles:

  • The ball moves according to its velocity vector
  • When the ball hits a wall or the platform, its velocity is reflected
  • The platform can be moved horizontally using arrow keys
  • The game tracks score and lives, with increasing difficulty per level

⚖️ License

Distributed under the MIT License. See LICENSE for details.


Note: This implementation is for educational and entertainment purposes. The game logic and physics are simplified for demonstration purposes.

About

Simple Pygame project simulating a bouncing ball with customizable physics and smooth animations. Ideal for beginners learning game development in Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages