A simple physics simulation using raylib where you can drag and shoot a ball that bounces off the walls, with gravity and sound effects.
- 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.
- raylib (v4.0 or higher recommended)
- C++ compiler (e.g., g++, clang++, MinGW)
- CMake or Make (optional, for building)
git clone https://github.com/Am1n1602/bouncing-ball.git
cd bouncing-ballsudo apt-get install libraylib-devOr build from source:
git clone https://github.com/raysan5/raylib.git
cd raylib
mkdir build && cd build
cmake ..
make
sudo make installSee the raylib wiki for Linux for further details.
- Download and run the raylib installer for Windows.
- Or, set up raylib with MSYS2:
pacman -S mingw-w64-x86_64-raylib
- For Visual Studio or more, see the raylib Windows guide.
makemkdir build && cd build
cmake ..
makeg++ source.cpp -o bouncing-ball -lraylib -lGL -lm -lpthread -ldl -lrt -lX11(Adjust linker flags as needed for your OS.)
./bouncing-ball- 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.
Sound effect is not working on Linux devices.
MIT License
