https://github.com/skhalifa05/RayLib-Pong
Paddle Bounce Game is a simple engaging game built with Raylib, where players control a paddle to keep a bouncing ball in play. The game features dynamic ball physics, a scoring system, and a limited number of lives. Players move the paddle using arrow keys to prevent the ball from falling off the screen.
https://github.com/skhalifa05/RayLib-Pong
ball bounce cpp opengl paddle raylib
Last synced: 7 months ago
JSON representation
Paddle Bounce Game is a simple engaging game built with Raylib, where players control a paddle to keep a bouncing ball in play. The game features dynamic ball physics, a scoring system, and a limited number of lives. Players move the paddle using arrow keys to prevent the ball from falling off the screen.
- Host: GitHub
- URL: https://github.com/skhalifa05/RayLib-Pong
- Owner: skhalifa05
- Created: 2025-02-06T13:13:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-08T11:55:05.000Z (over 1 year ago)
- Last Synced: 2025-02-08T12:28:49.752Z (over 1 year ago)
- Topics: ball, bounce, cpp, opengl, paddle, raylib
- Language: C
- Homepage:
- Size: 4.72 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Raylib Pong Game ๐ฎ
A simple **pong game** built using **C++** and **Raylib**. The game features a paddle controlled by the player, a bouncing ball, and a lives system. The goal is to keep the ball from falling off the screen while increasing your score.

## Game Concept
**Paddle Bounce** challenges players to control a paddle at the bottom of the screen, bouncing a ball to keep it in play. The goal is to maintain control, avoid missing the ball, and rack up points by bouncing it off the paddle. Players have a limited number of lives, and the game ends when all lives are lost.
## Gameplay
* Use the left (โ) and right (โ) arrow keys to move the paddle.
* The ball bounces off the paddle and walls, but if it falls below the screen, you lose a life.
* The game tracks your score and lives, displaying them in real time.
* The ball changes color when it bounces off the paddle.
* The game ends when you run out of lives.
## Features
* **Paddle Control**: Move left and right to hit the ball.
* **Dynamic Ball Physics**: Ball bounces off walls, ceiling, and paddle.
* **Score System**: Gain points for successful paddle hits.
* **Life System**: Lose a life when the ball touches the bottom.
* **Color Switching**: Paddle hits change the background color.
* **Screen Wrapping**: Paddle re-enters from the opposite side if it moves beyond the screen boundaries.
* **Power-Up System**: Collect power-ups that spawn randomly to enhance gameplay. Power-ups can provide effects such as:
* **Larger Paddle**: increases the paddleโs width for easier ball control.
* **Extra Life**: Grants an additional life to extend gameplay.
## Code Structure
The game follows an object-oriented design and includes the following classes:
Class | Responsibility
--- | --- |
GameManager | Controls game logic, updates, and rendering (Singleton Pattern).
Ball | Handles movement, bouncing, and resets.
Paddle | Controls user input and movement.
LivesManager | Tracks player lives and updates the UI.
PowerUpManager | Spawns, tracks, and executes power-ups.
PowerUp | Base class for all power-ups, defining common behavior.
LargerPaddle | Inherits from PowerUp, increases paddle size when activated.
ExtraLife | Inherits from PowerUp, grants an additional life.
## ๐ Project Structure
๐ฆ PaddleBounce
โโโ include/
โโโ lib/
โโโ src/
โ โโโ PowerUps/
โ โ โโโ ExtraLife.h # Header for Extra Life
โ โ โโโ ExtraLife.cpp # PowerUp for Larger Paddle Powerup
โ โ โโโ LargePaddle.h # Header for Larger Paddle Powerup
โ โ โโโ LargePaddle.cpp # PowerUp for Larger Paddle Powerup
โ โ โโโ PowerUp.h # Powerup Interface
โ โโโ main.cpp # Game loop and initialization
โ โโโ GameManager.cpp # Singleton managing game logic
โ โโโ Ball.cpp # Ball physics and movement
โ โโโ Paddle.cpp # Paddle control
โ โโโ LivesManager.cpp # Lives tracking
โ โโโ GameManager.h # Header for GameManager
โ โโโ Ball.h # Header for Ball class
โ โโโ Paddle.h # Header for Paddle class
โ โโโ LivesManager.h # Header for LivesManager class
โโโ README.md # Project documentation
โโโ Makefile # Build instructions
## Prerequisites
* C++ Compiler (GCC, Clang, MSVC)
* Raylib installed (https://github.com/raysan5/raylib/releases)
## Possible Improvements ๐
* Add difficulty levels (ball speed increases over time).
* Implement a pause menu and restart option.
* Add sound effects for collisions.
* Introduce power-ups (e.g., bigger paddle, slow-motion).
## License
This project is open-source under the MIT License.