# lukosha58/ping-pong architecture

> Architecture diagram of the GitHub repository lukosha58/ping-pong, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lukosha58/ping-pong
- Repository: https://github.com/lukosha58/ping-pong

## Overview

A small Pygame Pong game for two players: the player opens a menu, starts a match, controls separate paddles, and plays until one side reaches 10 points. The main loop owns game updates and scoring checks; the ball handles collisions, scoring changes, and impact playback. README documents the two-player Pong goal, and the menu source shows help and exit options. The tree supports the bundled asset paths, but no additional runtime integrations are evident.

Main entry points: [`main_menu.py`](https://github.com/lukosha58/ping-pong/blob/master/main_menu.py) (Menu), [`main.py`](https://github.com/lukosha58/ping-pong/blob/master/main.py) (Game loop), [`ball.py`](https://github.com/lukosha58/ping-pong/blob/master/ball.py) (Ball physics), [`pad.py`](https://github.com/lukosha58/ping-pong/blob/master/pad.py) (Paddles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_menu["Menu"]
  node_menu_app["Menu<br/>[main_menu.py]"]
  node_menu_assets["Menu assets"]
  node_menu_audio["Menu music<br/>[menu_music.ogg]"]
end

subgraph group_match["Match"]
  node_game_loop["Game loop<br/>[main.py]"]
  node_paddles["Paddles<br/>[pad.py]"]
  node_ball["Ball physics<br/>[ball.py]"]
  node_impact_audio["Impact sound<br/>[impact.ogg]"]
  node_game_audio["Gameplay music<br/>[gameplay.ogg]"]
  node_font["Pixel font"]
end

node_player(("Player"))

node_player -->|"opens menu"| node_menu_app
node_menu_app -->|"loads background"| node_menu_assets
node_menu_app -->|"plays"| node_menu_audio
node_menu_app -->|"starts match"| node_game_loop
node_game_loop -->|"updates"| node_paddles
node_game_loop -->|"updates"| node_ball
node_ball -->|"changes scores"| node_paddles
node_ball -->|"plays on impact"| node_impact_audio
node_game_loop -->|"plays"| node_game_audio
node_game_loop -->|"renders text"| node_font
node_menu_app -->|"renders text"| node_font

click node_menu_app "https://github.com/lukosha58/ping-pong/blob/master/main_menu.py"
click node_menu_assets "https://github.com/lukosha58/ping-pong/tree/master/images"
click node_menu_audio "https://github.com/lukosha58/ping-pong/blob/master/music/menu_music.ogg"
click node_game_loop "https://github.com/lukosha58/ping-pong/blob/master/main.py"
click node_paddles "https://github.com/lukosha58/ping-pong/blob/master/pad.py"
click node_ball "https://github.com/lukosha58/ping-pong/blob/master/ball.py"
click node_impact_audio "https://github.com/lukosha58/ping-pong/blob/master/music/impact.ogg"
click node_game_audio "https://github.com/lukosha58/ping-pong/blob/master/music/gameplay.ogg"
click node_font "https://github.com/lukosha58/ping-pong/tree/master/font"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_menu_app,node_menu_assets,node_menu_audio toneBlue
class node_game_loop,node_paddles,node_ball,node_impact_audio,node_game_audio,node_font toneAmber
class node_player toneIndigo
```

## Components

### Menu

- [Menu](https://github.com/lukosha58/ping-pong/blob/master/main_menu.py): `main_menu.py`
- [Menu assets](https://github.com/lukosha58/ping-pong/tree/master/images): `images`
- [Menu music](https://github.com/lukosha58/ping-pong/blob/master/music/menu_music.ogg): `music/menu_music.ogg`

### Match

- [Game loop](https://github.com/lukosha58/ping-pong/blob/master/main.py): `main.py`
- [Paddles](https://github.com/lukosha58/ping-pong/blob/master/pad.py): `pad.py`
- [Ball physics](https://github.com/lukosha58/ping-pong/blob/master/ball.py): `ball.py`
- [Impact sound](https://github.com/lukosha58/ping-pong/blob/master/music/impact.ogg): `music/impact.ogg`
- [Gameplay music](https://github.com/lukosha58/ping-pong/blob/master/music/gameplay.ogg): `music/gameplay.ogg`
- [Pixel font](https://github.com/lukosha58/ping-pong/tree/master/font): `font`

### Other components

- **Player**

## Connections

- Player → Menu: opens menu
- Menu → Menu assets: loads background
- Menu → Menu music: plays
- Menu → Game loop: starts match
- Game loop → Paddles: updates
- Game loop → Ball physics: updates
- Ball physics → Paddles: changes scores
- Ball physics → Impact sound: plays on impact
- Game loop → Gameplay music: plays
- Game loop → Pixel font: renders text
- Menu → Pixel font: renders text
