https://github.com/fahadelahikhan/bouncing-ball-pygame
Simple Pygame project simulating a bouncing ball with customizable physics and smooth animations. Ideal for beginners learning game development in Python.
https://github.com/fahadelahikhan/bouncing-ball-pygame
2d-animation beginner-projects bouncing-ball game-development interactive-games physics-simulation pygame pygame-tutorial python python-game
Last synced: about 1 year ago
JSON representation
Simple Pygame project simulating a bouncing ball with customizable physics and smooth animations. Ideal for beginners learning game development in Python.
- Host: GitHub
- URL: https://github.com/fahadelahikhan/bouncing-ball-pygame
- Owner: fahadelahikhan
- License: mit
- Created: 2024-08-24T16:35:25.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-13T09:41:28.000Z (about 1 year ago)
- Last Synced: 2025-03-13T10:33:57.622Z (about 1 year ago)
- Topics: 2d-animation, beginner-projects, bouncing-ball, game-development, interactive-games, physics-simulation, pygame, pygame-tutorial, python, python-game
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bouncing Ball Pygame 🎮


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:
```bash
git clone https://github.com/fahadelahikhan/Bouncing-Ball-Pygame.git
cd Bouncing-Ball-Pygame
```
2. Install required dependencies:
```bash
pip install pygame
```
3. Run the game:
```bash
python main.py
```
### Basic Usage
```python
# 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
```python
# 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](LICENSE) for details.
---
> **Note**: This implementation is for educational and entertainment purposes. The game logic and physics are simplified for demonstration purposes.