As a homework assignment for an introductory CS course, our task was to build a mouse-controlled version of the game Breakout! with full hit detection, lives, winning, and losing logic. I decided to put a lot into this assignment as I found it quite fun!
While the code is availabe on GitHub, it will not compile correctly as it is missing the graphics library provided by my instructors. Nonetheless, I strove to incorporate best object oriented programming practices. Instead of hardcodings the physics logic into brick objects, I created an interface for bounceable objects and built the small physics engine from that, allowing for easy incorporation of new obstacles by only calling the interface. Therefore, every object in the game, minus the ball, including the walls, is a bounceable object. From that, I created barrier objects, where the paddle, bricks, and walls are barrier objects. The ball checks eight points for collision detection, and handles getting "stuck" inside a bounceable.
Overall, this was quite simple on the surface as a first Java project, but required a fair amount of problem solving and work to implement best practices. A screenshot and UML are shown below.