A classic arcade-style Brick-Breaker game built using Java and the Swing GUI toolkit. The player controls a paddle at the bottom of the screen to bounce a ball upward and destroy a grid of bricks. The ultimate objective is to clear all the bricks while preventing the ball from falling past the paddle!
This project was developed to practice object-oriented programming (OOP) principles, 2D graphics rendering, and real-time game loops in Java.
- Object-Oriented Programming (OOP): Separate classes manage distinct game entities such as the Ball, Paddle, Brick Generator, and Gameplay controller.
- Event Handling: Uses KeyListener to capture real-time user inputs for smooth paddle movement.
- Game Loop & Timers: Utilizes a javax.swing.Timer to drive the game loop, handling real-time physics updates and screen repainting at a consistent frame rate.
- Collision Detection: Implements precise bounding-box collision logic to manage ball interactions with walls, the paddle, and individual bricks.
- 2D Graphics Rendering: Uses Java's Graphics and Graphics2D classes to dynamically draw the game elements, scores, and menus on a JPanel.
Smooth Paddle Control: Responsive left and right arrow key interactions. Dynamic Brick Layout: Automatically generates a grid of bricks that track their own destruction states. Real-time Scoring System: Tracks and displays your current score as you destroy bricks. Game State Management: Includes interactive screens for Gameplay, Game Over (when lives run out), and Victory (when all bricks are cleared), with quick-restart functionality.