A classic Pong-style game implemented in Python using the Turtle module.
- Project Description
- Features
- Development Environment
- Requirements
- Installation
- Running the Game
- Controls
- Project Structure
- Contribution Guidelines
This repository contains a simple two-player Ping Pong (Pong) game built with Python's Turtle graphics library. It demonstrates basic game mechanics such as:
- Ball movement and angle-based trajectory
- Collision detection with paddles and walls
- Keeping and displaying scores
- Resetting the ball upon a miss
- Smooth paddle controls with keyboard input
- Realistic ball physics (angle reflection on collision)
- Scoreboard display for both players
- Automatic reset of the ball after missing a paddle
- Adjustable ball speed and angle
- Operating System: Arch Linux (also tested on Windows and Linux Mint)
- IDE: Visual Studio Code
- Python Version: 3.8+
- Hardware: Development tested on systems with NVIDIA RTX 3050 GPU (face recognition module, future extension) and typical CPU setups
Note: The game logic is contained in
ball.py,paddle.py,scoreboard.py, and orchestrated bymain.py.
-
Python 3.8 or higher
-
Standard library modules:
turtlerandomtime
-
Clone the repository:
git clone https://github.com/yourusername/ping-pong-game.git cd ping-pong-game -
(Optional) Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # Linux/macOS venv\\Scripts\\activate # Windows
-
Ensure you have Python 3.8+ installed:
python --version
From the project root, run:
python main.pyThe game window will open. Use the controls below to play.
-
Left Paddle (Player 1):
- Move Up:
W - Move Down:
S
- Move Up:
-
Right Paddle (Player 2):
- Move Up:
Up Arrow - Move Down:
Down Arrow
- Move Up:
ping-pong-game/
├── ball.py # Ball class: movement, collision, reset
├── paddle.py # Paddle class: positioning and controls
├── scoreboard.py # Scoreboard class: tracking and displaying score
└── main.py # Entry point: game setup and main loop
Contributions are welcome! To contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature-name) - Make your changes and commit (
git commit -m 'Add feature') - Push to the branch (
git push origin feature-name) - Open a Pull Request
Please follow standard GitHub workflow and ensure code quality.