0% found this document useful (0 votes)
106 views19 pages

Academic Year: 2024-25: "Brick Breaker Game"

Uploaded by

rutujaghungarde2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views19 pages

Academic Year: 2024-25: "Brick Breaker Game"

Uploaded by

rutujaghungarde2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

A MICRO PROJECT REPORT ON

“BRICK BREAKER GAME”


Program & Program code: CO5I
Course Name : AJP
Course code : 22517
Submitted by,

NAME OF STUDENT ENROLLEMENT NO PROGRAM


Rajeshwari Prashant Kadyal 2214640063 CO5I
Srushti Ashok Shinde 2214640058 CO5I
Siddhi Subhash Shinde 2214640070 CO5I
Vaishnavi Rajendra Dongare 2214640066 CO5I

Under the Guidance of

Prof. Palwe P.D


In partial fulfillment of requirement for the
award of Diploma in Computer Engineering

MSBTE, Mumbai.

Academic Year: 2024-25

DEPARTMENT OF COMPUTER ENGINEERING


S.S.M. ADSUL POLYTECHNIC COLLEGE
CHAS,AHMEDNAGAR-414 005(M.S)

1
DEPARTMENT OF COMPUTER ENGINEERING
S.S.M. ADSUL POLYTECHNIC COLLEGE,

CHAS, AHMEDNAGAR-414 005(M.S)

CERTIFICATE
This is to certify that the micro project report entitled
Submitted by

NAME OF STUDENT ENROLLEMENT NO PROGRAM


Rajeshwari Prashant Kadyal 2214640063 CO5I
Srushti Ashok Shinde 2214640058 CO5I
Siddhi Subhash Shinde 2214640070 CO5I
Vaishnavi Rajendra Dongare 2214640066 CO5I

Of semester I institute, Sau. Sundarabai Manik Adsul Polytechnic, Chas, Ahmednagar


(code: 1464) has completed the micro project satisfactorily in course (22517) for the Academic
year 2023-24 as prescribed in the MSBTE curriculum.

Place: Ahmednagar
Date: / /2024-25

Prof.Palwe P.D Prof.Hole.P.P Prof.Gadakh.R.S


(Micro Project guide) (Head of Dept.) (Principal)

2
ACKNOWLEDGEMENT

We take this opportunity to acknowledge the constant encouragement and


continuous help given to me by my guide Prof Palwe P.D convey my sincere
thanks to his valuable timely suggestion.

We would also like to thanks principal Prof Gadakh R.S and Head of
Computer Department Prof Hole P.P we would also like to thank teaching staff of
Computer Department for helping us to achieve this goal.

We are also thankful to those who directly or indirectly helped me for


completing this micro project. We would like to thank my parents without whose
supports; the completion of the micro project would not have been possible.

Kadyal Rajeshwari Prashant


Shinde Srushti Ashok
Shinde Siddhi Subhash
Dongare Vaishnavi Rajendra

3
INDEX

Sr. No. Content Page No.

PART-I
1.0 Aims/Benefits of the Micro-Project 05

2.0 Course Outcomes Addressed 05

3.0 Proposed Methodology 05

4.0 Action Plan 06

5.0 Resources Required 06

PART-II
1.0 Rationale 07-08

2.0 Aims/Benefits of the Micro-Project 9

3.0 Course Outcomes Achieved 9

4.0 Actual Methodology Followed/Program Code 10-16

5.0 Outputs of the Micro-Projects 17-18

6.0 Actual Resources Used 18

7.0 Skill Developed / Learning outcomes of this Micro-Project 19

8.0 Conclusion 19

4
PART-I

1.0 Aims/Benefits of the micro project


The aim of the course is to help the student to affiant following industry identify compendancy
through various teaching, learning experience.

2.0 Course outcome addressed.

• Develop a program using Java Swing in java.

• Apply the concept of inheritance and Listeners in the program.

• Develop a program using Action Listener in java.

3.0 Proposed methodology

1. Focused on the selection of an appropriate topic for the micro-project.

2. Select the topic i.e. To Prepare a report on Create a Brick Breaker Game.

3. Brief study on our topic.

4. Gather all information based on the topic of the micro project.

5. Analysis and study of our topic in detail.

6. Following all the above methodologies we successfully completed our micro project.

5
4.0 Action Plan

Sr. Detail of activity Plan start Plan finish Name of


No. date date responsible team
members
1 Searching the topic for micro-project 28-09-2023 30-09-2023 Shinde Siddhi

2 Collect information from the internet 03-10-2023 06-10-2023 Shinde Srushti


and textbook

3 Collect information from the AJP 07-10-2023 12-10-2023 Kadyal Rajeshwari


Advance Java programming (22417)

4 Arrange all information in MS word 13-10-2023 20-10-2023 Shinde Siddhi

5 Prepare a report on it using MS word 21-10-2023 23-10-2023 Kadyal Rajeshwari

6 Print micro project 28-10-2023 30-10-2023 Dongare Vaishnavi

5.0 Resources used

Sr. Name of resource Specifications Quantity


no. material
1 Computer System 16 GB RAM, Windows 10 OS 1

2 Software JDK21 -

3 textbook/manual AJP Advance Java Programming 1


22417

6
PART-II

1.0 Brief Introduction/Rationale

Java is object-oriented, cross platform, multi-purpose artificial language created by Sun


Microsystem. 1st free in 1955, it had been developed to be a machine freelance net technology. It
had been supported C and C++ syntax to create it straightforward for programmers from those
communities to be told. Since then, it had been attained a distinguished place within the world of
programing. Java has several characteristics that have contributed to its popularity:

Platform freelance – several languages area unit compatible with only 1 platform. Java was
specifically designed in order that it might run on any laptop, regardless if it had been running
Windows, Linux, Mac, UNIX operating system or any of the opposite software package.

Simple and simple to use – Java’s creators tried to style it therefore code can be written with
efficiency and simply. Java doesn't have some drawbacks. Since its automatic trash collection, it
will tend to use additional memory than alternative similar languages. There area unit typically
implementation variations on completely different platforms, that have LED to Java being delineated
as a “write once, check everywhere” system. Lastly, since it uses associate degree abstract “virtual
machine”, a generic java program doesn’t have access to native API’s on a system directory.

 What is Listeners?

In Java, a listener is an object that receives and processes events, such as mouse clicks, key presses,
or window activation. Listeners are connected to an event object, which defines the event. For
example, a JButton or JTextField is an event source.
Here are some examples of listeners in Java:

• MouseMotionListener
Defines methods to receive notifications when the mouse is moved or dragged
• HttpSessionListener
Manages state or resources associated with a series of requests made in a Web application from the
same user or client
• ServletContextListener
Manages resources or state held at a VM level for the application

• MessageListener
An asynchronous event handler for messages that implements the MessageListener interface To
define a listener class, you implement a listener interface. When a listener method is invoked, it
receives an event that contains information about the event.

7
Here are some types of listeners in Java:
• Action Listener: Receives action events, such as a button or menu item click
• AdjustmentListener: Receives adjustment events, such as those emitted by a Scrollbar or
ScrollPane
• AWTEventListener: Receives notifications of events for objects that are instances of Component
or MenuComponent or their subclasses
• ComponentListener: Receives component events
• ContainerListener: Receives container events
• FocusListener: Receives keyboard focus events on a component
• ServletContextListener: Listens to startup and shutdown events of a context

8
2.0 Aims/Benefits of the micro project

Develop a Brick Breaker Game

Benefit Taken from this micro-project is understanding the concept of making a Brick Breaker
Game using java.

3.0 Course Outcome Achieved

• We able to create a simple brick breaker game in Java.


• We able to use the Java listeners to create a user-friendly interface.
• We able to implement event handlers to respond to user input.
• We to handle errors and exceptions.
• We able to debug their code.
• We able to deploy their applet to a web page.

9
4.0 Actual Methodology Followed/Program Code

import javax.swing.*;

import java.awt.*; import

java.awt.event.*; class

BrickMap { public int

brickLayout[][]; public

int brickWidth; public

int brickHeight;

public BrickMap(int rows, int columns) {

brickLayout = new int[rows][columns]; for (int

i = 0; i < brickLayout.length; i++) { for (int j

= 0; j < brickLayout[0].length; j++) {

brickLayout[i][j] = 1;

brickWidth = 540 / columns;

brickHeight = 150 / rows;

public void draw(Graphics2D g) { for (int i

= 0; i < brickLayout.length; i++) { for (int j

= 0; j < brickLayout[0].length; j++) { if

(brickLayout[i][j] > 0) {

g.setColor(new Color(0xFFAA33)); // Modified brick color (Orange)

g.fillRect(j * brickWidth + 80, i * brickHeight + 50, brickWidth, brickHeight);

g.setStroke(new BasicStroke(4));

g.setColor(Color.BLACK);

g.drawRect(j * brickWidth + 80, i * brickHeight + 50, brickWidth, brickHeight);


}

10
}

public void setBrickValue(int value, int row, int col) {

brickLayout[row][col] = value;

class GamePanel extends JPanel implements KeyListener, Action Listener

{ private boolean isPlaying = true; private int playerScore = 0;

private int totalBricks = 21; private Timer timer; private int delay =

8; private int playerX = 310; private int ballPosX = 120; private

int ballPosY = 350; private int ballXDir = -1; private int ballYDir =

-2; private BrickMap brickMap; public GamePanel() {

brickMap = new BrickMap(3, 7); addKeyListener(this);

setFocusable(true);

setFocusTraversalKeysEnabled(false);

timer = new Timer(delay, this);

timer.start();

public void paint(Graphics g) {

// Background color

g.setColor(new Color(0xFFFFE0)); // Modified background color (Light

Yellow) g.fillRect(1, 1, 692, 592); brickMap.draw((Graphics2D) g);

g.fillRect(0, 0, 3, 592);

g.fillRect(0, 0, 692, 3);

g.fillRect(691, 0, 3, 592);

g.setColor(new Color(0x4169E1)); // Modified paddle color (Royal Blue)

g.fillRect(playerX, 550, 100, 12);

g.setColor(new Color(0xDC143C)); // Modified ball color (Crimson)

11
g.fillOval(ballPosX, ballPosY, 20, 20);

g.setColor(Color.black);

g.setFont(new Font("MV Boli", Font.BOLD, 25));

g.drawString("Score: " + playerScore, 520,

30); if (totalBricks <= 0) { isPlaying

= false; ballXDir = 0; ballYDir =

0;

g.setColor(new Color(0XFF6464));

g.setFont(new Font("MV Boli", Font.BOLD, 30));

g.drawString("You Won, Score: " + playerScore, 190, 300);

g.setFont(new Font("MV Boli", Font.BOLD, 20));

g.drawString("Press Enter to Restart.", 230, 350);

if (ballPosY > 570) {

isPlaying = false;

ballXDir = 0;

ballYDir = 0;

g.setColor(Color.BLACK);

g.setFont(new Font("MV Boli", Font.BOLD, 30));

g.drawString("Game Over, Score: " + playerScore, 190, 300);

g.setFont(new Font("MV Boli", Font.BOLD, 20));

g.drawString("Press Enter to Restart", 230, 350);

g.dispose();

@Override

public void actionPerformed(ActionEvent arg0)

{ timer.start(); if (isPlaying) {

if (new Rectangle(ballPosX, ballPosY, 20, 20).intersects(new Rectangle(playerX, 550, 100,

12
8))) {

ballYDir = -ballYDir;

for (int i = 0; i < brickMap.brickLayout.length; i++) {

for (int j = 0; j < brickMap.brickLayout[0].length; j++) {

if (brickMap.brickLayout[i][j] > 0) { int brickX =

j * brickMap.brickWidth + 80; int brickY = i *

brickMap.brickHeight + 50; int brickWidth =

brickMap.brickWidth; int brickHeight =

brickMap.brickHeight;

Rectangle rect = new Rectangle(brickX, brickY, brickWidth, brickHeight);

Rectangle ballRect = new Rectangle(ballPosX, ballPosY, 20,

20); Rectangle brickRect = rect; if

(ballRect.intersects(brickRect)) { brickMap.setBrickValue(0,

i, j); totalBricks--; playerScore += 5;

if (ballPosX + 19 <= brickRect.x || ballPosX + 1 >= brickRect.x +


brickRect.width)

ballXDir = -ballXDir;

else {

ballYDir = -ballYDir;

ballPosX += ballXDir;

ballPosY += ballYDir;

if (ballPosX < 0) {

ballXDir = -ballXDir;

13
}

if (ballPosY < 0) {

ballYDir = -ballYDir;

if (ballPosX > 670) {

ballXDir = -ballXDir;

repaint();

@Override

public void keyTyped(KeyEvent arg0) {

@Override

public void keyPressed(KeyEvent arg0) {

if (arg0.getKeyCode() == KeyEvent.VK_RIGHT)

{ if (playerX >= 600) { playerX =

600; } else { moveRight();

if (arg0.getKeyCode() == KeyEvent.VK_LEFT)

{ if (playerX < 10) { playerX = 10;

} else { moveLeft();

if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {

if (!isPlaying) {

isPlaying = true; ballPosX =

120; ballPosY = 350;

14
ballXDir = -1; ballYDir = -2;

playerScore = 0; totalBricks =

21; brickMap = new

BrickMap(3, 7); repaint();

public void moveRight() {

isPlaying = true;

playerX += 50;

public void moveLeft() {

isPlaying = true;

playerX -= 50;

@Override

public void keyReleased(KeyEvent arg0) {

public class BrickBreakerGame {

public static void main(String[] args) {

JFrame frame = new JFrame();

GamePanel gamePanel = new GamePanel();

frame.setBounds(10, 10, 700, 600);

frame.setTitle("Brick Breaker");

frame.setResizable(false);

frame.setVisible(true);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.add(gamePanel); } }

15
5.0 Outputs of the Micro-Projects

16
6.0 Actual Resources Use
Sr. no. Name of resource material Specifications Quantity

1 Computer System 16 GB RAM, Windows 10 OS 1

2 Software JDK21 -

3 textbook/manual AJP Advance Java Programming 1


22417

17
7.0 Skill Developed

1. Teamwork

2. Communication skills 3.

Problem-solving skills.

4. Creativity.

5. Critical thinking skills.

6.Able to get all information about Light properties.

8.0 Conclusion

Building a Brick Breaker game in Java is a fun and educational project for aspiring game developers.
It covers essential game development concepts and provides a foundation for more complex game
projects in the future. Roll up your sleeves, start coding, and have a blast developing your own Brick
Breaker game!

18
ANNEXURE II
Evaluation Sheet for the Micro Project
Academic Year : 2024-2025

Name of Faculty: Prof. Palwe.P.D

Course: AJP Course Code: 22417 Semester: 5th

Title of the Project: Brick Breaker Game


COs addressed by the Micro Project:

A: We able to create a basic Brick Breaker game in Java.

B: We able to use the Java Listeners to create a user-friendly interface.


Major learning outcomes achieved by students by doing the Project:
(a)Practical outcomes:

1. We able to create a basic Brick Breaker Game in Java

2. We able to use the Java Listeners to create a user-friendly interface.

Comments/Suggestion about team work/leadership/inter-personal communication (if any)

Sr. Student Name Marks out of 6 for Marks out of 4 for Total
No. performance in performance in oral/ out of
presentation (D5 10
group activity (D5
Col.9)
Col. 8)
1 KADYAL RAJESHWARI P.

2 SHINDE SRUSHTI A.

3 SHINDE SIDDHI S.

4 DONGARE VAISHNAVI R.

(Name & Signature of Faculty)

Prof. Palwe P.D

19

You might also like