An open API service indexing awesome lists of open source software.

https://github.com/brej-29/space-ping-pong

Space Ping Pong is a neon, arcade-style 2D pong game built with Python + Pygame. Play vs computer (E/M/H) or local two-player. Includes power-ups, particle effects, starfield, screen shake, and persistent high scores. Modular codebase (ball/paddle/powerups/game) easy to extend.
https://github.com/brej-29/space-ping-pong

2d-game ai-opponent arcade game game-development gamedev high-scores local-multiplayer open-source particle-effects ping-pong power-ups pygame python retro screen-shake starfield

Last synced: 3 months ago
JSON representation

Space Ping Pong is a neon, arcade-style 2D pong game built with Python + Pygame. Play vs computer (E/M/H) or local two-player. Includes power-ups, particle effects, starfield, screen shake, and persistent high scores. Modular codebase (ball/paddle/powerups/game) easy to extend.

Awesome Lists containing this project

README

          


πŸ›°οΈ Space Ping Pong


An arcade-style, neon space-themed ping pong game built with Python & Pygame


Space Ping Pong gameplay





Last Commit

Python Language
Pygame
License: MIT
OS




Built with the tools and technologies:



Python | Pygame | dataclasses | Enum | JSON (local storage) | OOP

---

## **Table of Contents**
* [Overview](#overview)
* [Features](#features)
* [Getting Started](#getting-started)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
* [Configuration](#configuration)
* [Usage](#usage)
* [Project Structure](#project-structure)
* [Controls](#controls)
* [Difficulty & Power-ups](#difficulty--power-ups)
* [License](#license)
* [Contact](#contact)

---

## **Overview**

**Space Ping Pong** is a colorful, fast-paced desktop game. It features a starfield background, particle effects, power-ups, screen shake, a high-score table, and both **Single-player (vs Computer)** and **Local Two-player** modes. The animated menu lets you pick a mode, toggle difficulty (E/M/H), view high scores, and exit.

> The game stores high scores locally (JSON), so your top results persist between runs.


### **Project Highlights**
- **Two Modes:** Play vs Computer (AI) or Local Human vs Human.
- **Dynamic Feel:** Particle bursts, pulsing menu text, starfield, and subtle screen shake.
- **Power-ups:** Speed Boost, Paddle Grow/Shrink, Shield, Multi-Ball, and Freeze.
- **High Scores:** Auto-saved locally and shown in a dedicated screen.
- **Lightweight:** Only external dependency is `pygame`.

---

## **Features**
- Animated main menu with difficulty toggle (E/M/H).
- AI opponent with difficulty scaling.
- Local 2-player option (separate key bindings).
- Multiple power-ups with visual feedback.
- Particle effects for hits/scoring and a trailing ball effect.
- Persistent high scores (JSON file).
- Clean, modular Python code split across multiple files.

---

## **Getting Started**

Follow these steps to set up and run the project on your machine.

### **Prerequisites**
- **Python 3.8+**
- **pip** (Python package manager)

### **Installation**
1. **Clone the repository (or download the source code):**
``` sh
git clone https://github.com/brej-29/space-ping-pong.git
cd
```

2. **Install dependencies:**
``` sh
pip install -r requirements.txt
```

### Configuration
This game runs out-of-the-box. Optional tweaks:
- **Window & FPS:** edit SCREEN_WIDTH, SCREEN_HEIGHT, and FPS in settings.py.
- **Default Difficulty:** in game.py (self.difficulty = Difficulty.MEDIUM), change to EASY or HARD.
- **High Scores file path:** adjust in storage.py if you want to store it somewhere else (e.g., a data/ folder).

### Usage
Run the game from the project root:
``` sh
python main.py
```
> If you’re using a virtual environment, activate it first (see above).

---

## Project Structure

``` bash
.
β”œβ”€ LICENSE
β”œβ”€ README.md
β”œβ”€ requirements.txt
β”œβ”€ gifs/
β”‚ └─ space-ping-pong.gif # gameplay preview (update name if different)
β”œβ”€ main.py # entrypoint (runs the game)
β”œβ”€ game.py # Game loop, states, drawing, event handling
β”œβ”€ settings.py # screen size, FPS, colors, etc.
β”œβ”€ enums.py # GameState, Difficulty, PowerUpType
β”œβ”€ vector.py # lightweight Vector2D
β”œβ”€ ball.py # Ball entity, physics & trail
β”œβ”€ paddle.py # Paddle entity, player/AI logic & effects
β”œβ”€ particles.py # Particle & Star classes
β”œβ”€ powerups.py # PowerUp entity & visuals
└─ storage.py # load/save high scores (JSON)

```

---

## **Controls**

**Menu**
- `1` β†’ Play vs Computer
- `2` β†’ Play vs Human
- `3` β†’ High Scores
- `E / M / H` β†’ Change difficulty
- `ESC` β†’ Quit

**Gameplay**
- **Player 1 (Right):** Arrow `↑` / `↓`
- **Player 2 (Left, only in Human vs Human):** `W` / `S`
- `SPACE` β†’ Pause / Resume

---

## **Difficulty & Power-ups**

- **Difficulty**
- The AI paddle behavior changes based on `Difficulty` (EASY / MEDIUM / HARD).
- You can toggle it from the menu using `E`, `M`, or `H`.
- To change the default, set `self.difficulty` in `game.py`.

- **Power-ups**
- **Speed Boost** – temporarily increases ball speed.
- **Paddle Grow / Shrink** – temporarily changes paddle size.
- **Shield** – gives a paddle a one-time protective barrier.
- **Multi-Ball** – spawns an additional ball.
- **Freeze** – briefly pauses ball/paddle updates.

> Power-ups spawn periodically and are collected when the ball collides with them. Particle bursts and highlights indicate pickups.

---

## **License**
This project is licensed under the **MIT License**. See the [`LICENSE`](LICENSE) file for details.

---

## **Contact**
Questions or feedback or want to collaborate? Reach out via my
**LinkedIn:** [Brejesh Balakrishnan](https://www.linkedin.com/in/brejesh-balakrishnan-7855051b9/)