Skip to content

A simple implementation of the classic Pong game, built in Python. This project is designed for learning purposes to explore Python syntax, practice programming concepts like OOP, Git and GitHub workflows.

Notifications You must be signed in to change notification settings

nicahmadi/PongGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build a Simple Pong Game with Python! 🎮

This project is a simple implementation of the classic Pong game, created for learning Python syntax, Object-Oriented Programming (OOP) concepts, and practicing Git/GitHub workflows.
The architecture follows a Clean Architecture-style separation to keep the codebase modular, testable, and easy to maintain.


📂 How the Project is Organized

Here’s the layout of the project to keep things tidy and modular:

.
├── config
├── domain
│   └── models
├── interface
└── use_case

📦 What Each Part Does

1️⃣ config

This is where you store all the game’s settings, like:

  • The size of the game window (width and height)
  • How fast the ball moves
  • Colors for the ball, paddles, and background
  • Frames per second (FPS) for smooth gameplay

2️⃣ domain/models

This folder holds the core "objects" of the game, called entities. You’ll create two main classes:

  1. Ball 🎾
    • Tracks its position (x, y) and speed (dx, dy)
    • Moves around and bounces off walls
    • Resets to the center after a point is scored
  2. Paddle 🏓
    • Moves up and down based on player input or a simple AI
    • Keeps track of its position on the screen

3️⃣ interface

This is the part that makes the game come to life visually! It handles:

  • Drawing the ball, paddles, and score on the screen using pygame
  • Listening for keyboard inputs (like arrow keys to move paddles)
  • Showing the current score

4️⃣ use_case

This is where the game’s logic lives. It’s responsible for:

  • Checking if the ball hits a paddle or goes out of bounds
  • Updating the score when someone scores
  • Resetting the game after a point
  • Supporting Player vs Player or Player vs AI modes

🚀 Get Started

Ready to play? Here’s how to run the game:

  1. Install pygame:
    pip install pygame
  2. Run the main script:
    python main.py

About

A simple implementation of the classic Pong game, built in Python. This project is designed for learning purposes to explore Python syntax, practice programming concepts like OOP, Git and GitHub workflows.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published