Pong was the last project I created using SFML and C++ in my second year of university. It is a 2 player-pong game following the classic formula.
For this project, I created a custom sprite object that handles the texture loading and handling. The player object inherits from that class that handles movement and collision checking. While the while a similar result could have been achieved using composition instead of inheritance, this was an object-oriented programming concept I wanted to include in the project for the assignment marks.
The collision is handled using a standard AABB collision detection and handling algorithm. The relationship between the classes is achieved by composition using a nested class to return collision information.
Commenti