A simple game and sandbox environment based on simulating the collision responses of balls
Link to the code on GitHub.
The program is based on OneLoneCoder's olc::PixelGameEngine as well as his videos on collision handling of balls with some deviations.
The goal is simple - the player tries to maximize the score by hitting (and destroying) as many obstacles as possible each turn by shooting balls along a chosen trajectory. After a turn, new obstacles spawn from below and the entire grid moves upwards; the game is over when any obstacle reaches the top (taking inspiration from Tetris).
If the player presses “s”, a background simulation indicates the predicted score, which hints at what I wanted to implement next: An AI to perfect the way the game is played. To that end, the code is ripe for an overhaul and several improvements. For one, the simulation speed should be enhanced, and the physics-system needs to be copied and modified - this is a perfect candidate for class encapsulation and operator overloading.
The sandbox mode is illustrated below: