Brick Breaker Game Project Report
Brick Breaker Game Project Report
A PROJECT REPORT
Submitted by
[Link] ( 8115U24EC067 )
in
DEPARTMENT OF
[Link] M.E.,(Ph.D.,)
ANNA UNIVERSITY
CHENNAI 600025.
DECEMBER - 2025
K. RAMAKRISHNAN COLLEGE OF ENGINEERING
(AUTONOMOUS)
SAMAYAPURAM – 621 112
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
ii
DECLARATION
I declare that the project report on “BRICK BREAKER GAME” is the result
of original work done by me and best of my knowledge, similar work has not been
submitted to “ANNA UNIVERSITY CHENNAI” for the requirement of Degree of
BACHELOR OF ENGINEERING. This project report is submitted on the partial
fulfilment of the requirement of the completion of the course EGB1201 – JAVA
PROGRAMMING.
Signature
NIRANJAN.S
Place: Samayapuram
Date:
iii
ACKNOWLEDGEMENT
I would like to thank Dr. D. SRINIVASAN, B.E, M.E., Ph.D., Principal, who
gave opportunity to frame the project the full satisfaction.
I render my sincere thanks to Course Coordinator and other staff members for
providing valuable information during the course.
iv
VISION
MISSION
M1. To equip the students with latest technical, analytical and practical
knowledge
PEO1: Graduates will become experts in providing solution for the Engineering
problems in Industries, Government and other organizations where they are
employed.
PEO2: Graduates will provide innovative ideas and management skills to
enhance the standards of the society by individual and with team works through
the acquired Engineering knowledge.
PEO3: Graduates will be successful professionals through lifelong learning and
contribute to the society technically and professionally.
v
industrial problems and for the demanding needs of the society in the domains of
electronic integrated circuits, signal processing, high frequency and antenna
design.
PROGRAM OUTCOMES
PO5: Engineering tool usage: Create, select, and apply appropriate techniques,
resources, and modern engineering and IT tools including prediction and
modeling to complex engineering activities with an understanding of the
limitations.
PO6: The Engineer and The World: Apply reasoning informed by the
vi
contextual knowledge to assess societal, health, safety, legal and cultural issues
and the consequent responsibilities relevant to the professional engineering
practice.
PO7: Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of engineering practice.
PO8: Individual and Collaborative Teamwork: Function effectively as an
individual, and as a member or leader in diverse teams, and in multidisciplinary
settings.
PO9: Communication: Communicate effectively on complex engineering
activities with the engineering community and with society at large. Some of
them are, being able to comprehend and write effective reports and design
documentation, make effective presentations, and give and receive clear
instructions.
PO10: Project Management and Finance: Demonstrate knowledge and
understanding of the engineering and management principles and apply these to
one’s own work, as a member and leader in a team, to manage projects and in
multidisciplinary environments.
PO11: Life-long learning: Recognize the need for and have the preparation and
ability to engage in independent and lifelong learning in the broadest context of
technological change.
CO-PO MAPPING
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PSO1 PSO2 PSO3
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
vii
ABSTRACT
viii
ABSTRACT WITH POs AND PSOs MAPPING
ix
TABLE OF CONTENTS
CHAPTER NO. TITLE PAGE NO.
ABSTRACT ix
1 INTRODUCTION 1
1.1 Objective 1
1.2 Overview 2
2 PROJECT METHODOLOGY 3
3 MODULE DESCRIPTION 7
x
4 CONCLUSION & FUTURE SCOPE 9
4.1 Conclusion 9
APPENDIX B (SCREENSHOTS) 25
REFERENCES 29
xi
CHAPTER 1
INTRODUCTION
1.1 Objective
1
1.2 Overview
The Brick Breaker Game starts with a welcoming front page displaying the
title and instructions. Upon starting, players use the left and right arrow keys to
control the paddle and the spacebar to launch the ball. The ball moves automatically,
bouncing off walls, bricks, and the paddle. Each brick destroyed adds to the player's
score. Players have three lives that decrease if the ball falls below the paddle.
Clearing all bricks advances the player to the next level, where brick patterns and ball
speed increase. The game concludes with either a "Game Over" or "Congratulations"
screen based on player performance.
Java Swing
Java Swing is a GUI toolkit that enables the creation of native-feel desktop applications
with a wide variety of components and layouts.
Key Features:
2
CHAPTER 2
PROJECT METHODOLOGY
3
The game architecture follows a strict three-tier MVC-inspired design ensuring
clean separation of concerns. The Presentation Layer ([Link]) initializes the
JFrame container and embeds the GamePlay JPanel as the rendering surface. The
Controller Layer ([Link]) manages the entire game lifecycle, implementing
keyboard listeners for game control and a timer-based loop for state updates and
rendering. It maintains all game states including score, lives, level, ball position and
direction, paddle position, and play status flags across different screens such as the
front page, instruction screen, gameplay, and end screens. The Model Layer
([Link]) encapsulates the two-dimensional brick layout, calculating
brick dimensions and setting level-specific colors. It provides essential methods to
draw bricks and update their status when hit. Collision detection is efficiently
implemented using Rectangle intersection checks with controlled flow to ensure
single hit registration per frame, supporting high-frame-rate rendering typical of
optimized Swing game development.
4
Keyboard controls provide intuitive paddle movement (arrow keys ±25px), ball
launch (SPACEBAR), level advancement (SPACE after completion), game
start/restart (ENTER), instructions toggle (I key), and ESC exit confirmation with
JOptionPane dialog. Front-page menu displays title, controls summary, and exit
prompt while gameplay HUD shows real-time score/lives/level at top border.
Persistent tracking maintains score/lives across entire playthrough with automatic
level-complete transitions displaying "LEVEL X COMPLETE!" message prompting
next stage advancement.
5
2.3 Architecture Diagram
6
CHAPTER 3
MODULE DESCRIPTION
This module is responsible for the real-time movement of the ball and all
collision detections. It detects collisions between the ball and paddle, bricks, and
window borders, updates ball direction accordingly, and triggers brick destruction. It
computes ball position updates based on velocity vectors and enforces game physics
realistically.
This module generates and manages the grid layout of bricks for each level. It
maintains the 2D array representing bricks, their positions, and visibility state after
collisions. It supports drawing bricks with level-specific colors and handles updates
when a brick is destroyed to remove it from the display.
This module tracks and updates the player’s score and remaining lives. It adds
points when bricks are broken, reduces lives when the ball falls below the paddle, and
provides game-over detection. This information is displayed on the game screen,
keeping players informed of their progress.
This module manages the progression between multiple levels. It adjusts brick
7
layout complexity and ball speed based on the current level. Upon clearing all bricks,
it advances the game state, resets positions, and prepares the next level. It also handles
win condition detection and displays victory messages.
8
CHAPTER 4
4.1 CONCLUSION
The Brick Breaker Game project successfully delivers a complete, fully
functional Java Swing desktop arcade application demonstrating professional game
development practices through clean modular architecture and robust
implementation.
9
4.2 FUTURE SCOPE
The future scope of the Brick Breaker Game includes numerous enhancements
to enrich gameplay and broaden its usability. Adding sound effects and background
music using the Java Sound API can significantly improve player immersion by
providing audio feedback for collisions, brick breaks, and level transitions.
Introducing power-ups such as multi-ball, paddle enlargement, or temporary ball
speed increases can add strategic depth and keep the gameplay engaging for longer
periods. Additionally, implementing persistent high-score tracking through file I/O or
database integration like SQLite will allow players to monitor their progress over time
and compete on leaderboards.
10
APPENDIX A
(SOURCE CODE)
import [Link].*;
import [Link].*;
11
switch (level) {
case 1 -> brickColor = new Color(0, 200, 255);
case 2 -> brickColor = new Color(255, 165, 0);
case 3 -> brickColor = new Color(144, 238, 144);
default -> brickColor = [Link];
}
[Link](new BasicStroke(3));
[Link]([Link]);
[Link](x, y, brickWidth, brickHeight);
}
}
}
}
12
import [Link].*;
import [Link].*;
import [Link].*;
public GamePlay() {
13
map = new MapGenerator(3, 7);
totalBricks = [Link] * [Link];
addKeyListener(this);
setFocusable(true);
setFocusTraversalKeysEnabled(false);
if (!gameStarted) {
drawFrontPage(g);
return;
}
[Link]([Link]);
[Link](0, 0, 700, 600);
[Link]((Graphics2D) g, level);
[Link]([Link]);
[Link](0, 0, 3, 600);
[Link](0, 0, 700, 3);
[Link](697, 0, 3, 600);
[Link]([Link]);
14
[Link](new Font("serif", [Link], 20));
[Link]("Score: " + score, 540, 30);
[Link]("Lives: " + lives, 450, 30);
[Link]("Level: " + level, 20, 30);
[Link]([Link]);
[Link](playerX, 550, 100, 8);
if (!ballLaunched) {
ballposX = playerX + 40;
ballposY = 530;
}
[Link]([Link]);
[Link](ballposX, ballposY, 20, 20);
[Link](ballposX, ballposY, 20, 20);
15
[Link](new Font("serif", [Link], 20));
[Link]("Final Score: " + score, 260, 340);
[Link]("Press ENTER to Restart", 230, 380);
}
if (lives == 0) {
[Link]([Link]);
[Link](new Font("serif", [Link], 30));
[Link]("GAME OVER", 250, 300);
[Link](new Font("serif", [Link], 20));
[Link]("Final Score: " + score, 260, 340);
[Link]("Press ENTER to Restart", 230, 380);
}
[Link]();
}
[Link]([Link]);
[Link](new Font("serif", [Link], 40));
[Link]("🎮 BRICK BREAKER 🎮", 130, 180);
[Link]([Link]);
[Link](new Font("serif", [Link], 22));
[Link]("Press ENTER to Start", 240, 270);
[Link]("Press I for Instructions", 230, 310);
16
[Link]("Press ESC to Exit", 250, 350);
if (showInstructions) {
[Link]([Link]);
[Link](new Font("serif", [Link], 18));
[Link]("➡ Move Left : Left Arrow Key", 210, 390);
[Link]("➡ Move Right: Right Arrow Key", 210, 420);
[Link]("➡ Launch Ball: Spacebar", 210, 450);
[Link]("➡ You have 3 lives total. Lose all and game ends.", 120,
480);
}
if (showExitPrompt) {
[Link]([Link]);
[Link](new Font("serif", [Link], 24));
[Link]("Exit Game? (Y to exit / N to cancel)", 130, 520);
}
}
if (play) {
17
A:
for (int i = 0; i < [Link]; i++) {
for (int j = 0; j < [Link][0].length; j++) {
if ([Link][i][j] > 0) {
int brickX = j * [Link] + 80;
int brickY = i * [Link] + 50;
Rectangle brickRect = new Rectangle(brickX, brickY,
[Link], [Link]);
Rectangle ballRect = new Rectangle(ballposX, ballposY, 20, 20);
if ([Link](brickRect)) {
[Link](0, i, j);
totalBricks--;
score += 5;
break A;
}
}
}
}
ballposX += ballXdir;
ballposY += ballYdir;
18
if (ballposX < 0) ballXdir = -ballXdir;
if (ballposY < 0) ballYdir = -ballYdir;
if (ballposX > 670) ballXdir = -ballXdir;
if (lives == 0) {
play = false;
}
}
}
repaint();
}
if (showExitPrompt) {
if ([Link]() == KeyEvent.VK_Y) {
[Link](0);
} else if ([Link]() == KeyEvent.VK_N) {
showExitPrompt = false;
repaint();
19
}
return;
}
if (key == KeyEvent.VK_RIGHT) {
playerX = [Link](playerX + 25, 600);
} else if (key == KeyEvent.VK_LEFT) {
playerX = [Link](playerX - 25, 10);
} else if (key == KeyEvent.VK_I) {
showInstructions = !showInstructions;
repaint();
} else if (key == KeyEvent.VK_ESCAPE) {
if (!gameStarted) {
showExitPrompt = true;
repaint();
} else {
int option = [Link](this,
"Exit to Main Menu? Current progress will be lost.",
"Exit Game", JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION) {
[Link](this, "Score: " + score);
backToFrontPage();
}
}
} else if (key == KeyEvent.VK_ENTER) {
if (!gameStarted) {
gameStarted = true;
20
resetGameState();
repaint();
return;
}
if (level == 2) {
map = new MapGenerator(4, 8);
} else if (level == 3) {
map = new MapGenerator(5, 9);
} else {
level = maxLevel + 1;
21
repaint();
return;
}
applyLevelSpeed();
ballLaunched = false;
play = false;
playerX = 310;
ballposX = playerX + 40;
ballposY = 530;
repaint();
}
if (level == 1) {
ballXdir = signX * 2;
ballYdir = signY * 3;
} else if (level == 2) {
ballXdir = signX * 3;
ballYdir = signY * 4;
} else if (level == 3) {
ballXdir = signX * 4;
22
ballYdir = signY * 5;
}
}
23
score = 0;
lives = 3;
level = 1;
map = new MapGenerator(3, 7);
totalBricks = [Link] * [Link];
}
import [Link].*;
24
APPENDIX B
(SCREENSHOTS)
BrickBreaker Game – Home Page
Game-Instruction page
25
Game Exit page
26
Game-Level 1 completion
27
Game-Level 2 completed
Game-game over
28
REFERENCES
29