This 2D Physics-based pool game was created using SFML and Box2D in C++. The game is relatively simple, making use of collisions, motors and sensors.

In the above screenshot, there are three motors and two sensors. The blue box in the middle is a sensor, which will reverse the direction of the blue spinning blades in the top-right corner when toggled. The orange box at the top is another sensor, which will open the orange gate in the bottom-left corner while held. The purple bar in the bottom right is a continuously moving platform.

The aim of the game is to score all the balls into the four corners. When a ball collides with the yellow square, it is removed and a point is added. You can do this either by using the white ball – aim with arrow keys to control the red laser and hold space to charge up a shot, or you can directly move the red cube with WASD.

Overall the game is relatively simple but is a good example of utilising physics in a C++ environment, and achieved a grade of 99/100 for the entire module. This particular part of the work, as the final submission, got 100/100.

If you’d like to try the game, you can download it below! (You will need 7-zip or similar to extract the archive). Alternatively, the source code is available here; the project was created in Visual Studio 2019, but has been tested and working fine in 2022 after retargeting solution.