Skip to content

Latest commit

 

History

History
179 lines (121 loc) · 4.59 KB

File metadata and controls

179 lines (121 loc) · 4.59 KB

Pong Game

Welcome to the Pong Game! This is a classic Pong game implementation using Pygame with both Single-Player and Multiplayer modes. Challenge yourself with AI or compete against a friend!

Installation

pip install -r requirements.txt

Game Modes

🎮 Single-Player Mode (single_player.py)

Play against an AI paddle with a lives system. Reach a score of 3 to win!

Features:

  • Lives System: Start with 3 lives. Lose one when the ball goes out of bounds.
  • Score System: Reach 3 points to win the game.
  • Time Limit: Complete your objective within 10 seconds.
  • Difficulty: Ball speed increases as you hit it.
  • HUD Display: Real-time display of Score, Lives, and Time remaining.

Controls:

  • LEFT ARROW or A key: Move paddle left
  • RIGHT ARROW or D key: Move paddle right

Win/Lose Conditions:

  • Win: Reach a score of 3 before time runs out
  • Lose: Lose all 3 lives OR time runs out

👥 Multiplayer Mode (main.py)

Play with another player in a classic two-player Pong format.

Controls:

  • Player 1: W to move up, S to move down
  • Player 2: UP ARROW to move up, DOWN ARROW to move down

Features

  • Background Music: Ambient space music during gameplay
  • Score Tracking: Real-time score display for all game modes
  • Game Timer: Time-based gameplay to add urgency
  • Welcome Screen: Intuitive start screen
  • Game Over Screens: Clear feedback for wins, losses, and ties
  • Smooth Gameplay: 60 FPS game loop for fluid motion

How to Run

Option 1: Single-Player Mode

python single_player.py

Option 2: Multiplayer Mode

python main.py

Or use the main entry point:

python main.py  # (if configured as default launcher)

Code Overview

The project is organized into two main game implementations:

single_player.py

  • Single-player vs AI paddle mode
  • Lives-based gameplay (3 lives per game)
  • 10-second time challenge
  • Score-based winning condition (reach 3 points)
  • Progressive difficulty (ball speed increases)

Key Modules:

  • welcome_screen() - Shows game introduction
  • game_loop() - Main single-player game loop
  • player_wins() - Victory screen
  • game_over() - Defeat screen
  • reset_game() - Resets all game variables

main.py

  • Two-player competitive mode
  • Vertical paddle controls
  • Parallel opponent handling
  • Score tracking for both players

Assets

  • assets/images/ - Game backgrounds and graphics
  • assets/music/ - Background music (space-120280.mp3)

Game Statistics

  • Screen Resolution: 800x600 pixels
  • Frame Rate: 60 FPS
  • Ball Radius: 15 pixels
  • Paddle Dimensions: 140px × 20px (single-player), 20px × 100px (multiplayer)
  • Game Duration: 10 seconds (single-player)
  • Lives: 3 (single-player)
  • Win Score: 3 points (single-player)

Gameplay Tips

Single-Player Mode:

  • Keep your paddle centered for better reaction time
  • The ball speeds up as you hit it—build momentum carefully
  • Watch the timer in the top-right corner
  • Try to reach 3 points before time expires

Multiplayer Mode:

  • Position your paddle to intercept the ball early
  • Use smooth, controlled movements
  • Anticipate ball bounces off walls

Future Improvements

  • Difficulty Levels: Easy, Medium, Hard modes
  • Power-ups: Score multipliers, slow-motion balls
  • Leaderboard: Track high scores
  • Customization: Adjustable paddle size, ball speed, colors
  • Sound Effects: Ball collision sounds and victory/defeat audio
  • Mobile Support: Touch controls for mobile devices
  • Pause Feature: Ability to pause mid-game

Project Structure

pong-game/
├── main.py              # Multiplayer game entry point
├── single_player.py     # Single-player game (with lives system)
├── requirements.txt     # Python dependencies
├── README.md           # This file
├── LICENSE             # MIT License
└── assets/
    ├── images/         # Game backgrounds
    └── music/          # Background music files

Requirements

See requirements.txt for dependencies:

  • pygame >= 2.1.0
  • Python >= 3.8

License

This project is licensed under the MIT License - see the LICENSE file for details.


Developed by: Halip26
Last Updated: April 2026

Enjoy the game! Feel free to fork and customize it for your own purposes. Enjoy the game!

License

This project is licensed under the MIT License - see the LICENSE file for details.


Developed by Halip26