An open API service indexing awesome lists of open source software.

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.

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.
![ss.png](ss.png)
## 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.