Skip to content

Am1n1602/Bouncing-Ball

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bouncing Ball

A simple physics simulation using raylib where you can drag and shoot a ball that bounces off the walls, with gravity and sound effects.

Features

  • Intuitive Drag and Shoot: Click and drag with your mouse to set the angle and power, then release to launch the ball.
  • Realistic Physics: The ball bounces off the walls with velocity dampening and is continuously pulled downward by gravity.
  • Sound Effects: A satisfying damp sound plays every time the ball collides with a wall for an immersive experience.

Requirements

  • raylib (v4.0 or higher recommended)
  • C++ compiler (e.g., g++, clang++, MinGW)
  • CMake or Make (optional, for building)

Installation

1. Clone the repository

git clone https://github.com/Am1n1602/bouncing-ball.git
cd bouncing-ball

2. Install raylib

On Linux (Ubuntu/Debian):

sudo apt-get install libraylib-dev

Or build from source:

git clone https://github.com/raysan5/raylib.git
cd raylib
mkdir build && cd build
cmake ..
make
sudo make install

See the raylib wiki for Linux for further details.

On Windows:

3. Build the project

Using Makefile

make

Using CMake (Recommended)

mkdir build && cd build
cmake ..
make

Compile manually (if needed/Not Tested)

g++ source.cpp -o bouncing-ball -lraylib -lGL -lm -lpthread -ldl -lrt -lX11

(Adjust linker flags as needed for your OS.)

4. Run the simulation

./bouncing-ball

How to Play

  • Drag: Click and drag the ball with your mouse to choose direction and force.
  • Shoot: Release the mouse button to launch.
  • Bounce: The ball will bounce off the walls and be pulled down by gravity.
  • Listen: Each wall collision triggers a damp sound effect.

Demo

Issues

Sound effect is not working on Linux devices.

License

MIT License


About

A simple drag and shoot bouncing ball

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors