A classic arcade Pong experience rebuilt in C++ with smooth physics, a reactive CPU opponent, difficulty selection, and progressive speed mechanics.
- ๐ฎ Player vs CPU โ go head-to-head against a reactive CPU opponent
- ๐ง Difficulty selection โ choose Easy, Medium, or Hard from the startup menu
- ๐ Angle-based deflection โ where you hit the paddle changes the ball's trajectory
- โก Progressive speed โ rallies get faster the longer they go, resetting on each score
- ๐ Live scoreboard โ scores displayed in real time
- ๐จ Custom color palette โ clean green-toned visuals with rounded paddles
| File | Description |
|---|---|
main.cpp |
Game loop, menu, initialization & collision detection |
Ball.cpp / Ball.h |
Ball movement, physics & speed scaling |
Paddle.cpp / Paddle.h |
Player and CPU paddle logic |
Colors.h |
Custom color palette |
Windows (MinGW)
Install raylib and place the files at:
C:\raylib\include\raylib.h
C:\raylib\lib\libraylib.a
Then build:
mkdir build
cd build
cmake .. -G "MinGW Makefiles"
cmake --build .macOS
brew install raylib
mkdir build && cd build
cmake ..
cmake --build .Linux
sudo apt install libraylib-dev # or equivalent for your distro
mkdir build && cd build
cmake ..
cmake --build .Your executable will appear in the build folder. For subsequent builds, only cmake --build . is needed.
| Key | Action |
|---|---|
| Arrow Up | Move paddle up |
| Arrow Down | Move paddle down |
| ESC | Return to menu |
| Close window | Quit |
- On startup, select a difficulty and press Start Game
- You control the right paddle โ the CPU controls the left
- Get the ball past your opponent to score a point
- Hit the edge of your paddle for sharper, trickier angles
- Survive long rallies โ the ball speeds up every 4 hits and resets when someone scores
- Press ESC at any time to return to the menu
| Difficulty | CPU Speed | CPU Accuracy |
|---|---|---|
| Easy | Slow | Aims imprecisely |
| Medium | Moderate | Slight offset tracking |
| Hard | Fast | Near-perfect tracking |
Tune the feel of the game directly in Ball.h:
| Property | Default | Description |
|---|---|---|
base_speed |
7.0 |
Starting ball speed |
max_speed |
15.0 |
Maximum ball speed cap |
speed_increment |
0.5 |
Speed added per speed-up event |
hits_until_speedup |
4 |
Paddle hits between each speed increase |
Feel free to use, modify, and build on this project. Have fun!
