Skip to content

connerTeev/Pong-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

๐Ÿ“ Pong Game

A classic arcade Pong experience rebuilt in C++ with smooth physics, a reactive CPU opponent, difficulty selection, and progressive speed mechanics.

Gameplay

โœจ Features

  • ๐ŸŽฎ 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

๐Ÿ“ Project Structure

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

๏ฟฝ๏ฟฝ๏ฟฝ๏ธ Requirements

  • C++17 or later
  • raylib v4.0+
  • CMake 3.15+
  • A C++ compiler โ€” g++ / MinGW-w64 on Windows

๐Ÿš€ Building

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.


๐Ÿ•น๏ธ Controls

Key Action
Arrow Up Move paddle up
Arrow Down Move paddle down
ESC Return to menu
Close window Quit

๐ŸŽฏ How to Play

  • 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 Levels

Difficulty CPU Speed CPU Accuracy
Easy Slow Aims imprecisely
Medium Moderate Slight offset tracking
Hard Fast Near-perfect tracking

โš™๏ธ Physics Configuration

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

๐Ÿ“œ License

Feel free to use, modify, and build on this project. Have fun!

About

The classic Pong video game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors