Aditya Project Report

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

A synopsis on Java Brick Breaker’s Game

G.L BAJAJ INSTITUTE OF


MANAGEMENT

BCA
(Fifth Semester)

SUBMITTED TO :- SUBMITTED BY :-

Mrs. Priyanka Joshi Aditya Mani


Tripathi Adarsh
Kumar

Session (2021 – 2022)


CERTIFICATE
This is to certify that Aditya mani tripathi , Adarsh Kumar have
successfully completed a synopsis on “Java Brick Breaker’s Game”
project. Which is benefited work for carried out his partial fulfillment of
BCA G.L BAJAJ INSTITUTE OF MANAGEMENT.

(Project Guide)
Mrs. Priyanka Joshi
Acknowledgement
This project is not only my worth effort but many people directly and
indirectly helped me to prepare the project. I want to thank specially
………………. and other staff for so much gentle and kind support. My
friends provided guideline to me to prepare the project. Then many of my
friends helped me to prepare this project.

Concept of this project “Java Brick Breaker’s Game” I got from the
internet and then started it but was not sure to complete it but this was
made possible by the help of my teachers and my friends.

After this I will like to thank all my family member who are so helping
and caring ,I will like to thank all my teaching staff who helped me so
much as all concepts are interrelated .
Preface
This project is submitted by Aditya mani tripathi , Adarsh Kumar This
project has been coded in Java language’s, it has been tried to made so as
to be error free but still some may be left so please avoid those mistakes.
Project is in the form of programs which are made in Java language.

I think reader of the project will ignore my small mistakes. He/she will
allow me to put forward my concepts and understanding of project in
practical form.

I will feel great if any of person reading documents will be benefited a bit
by my work.

Thanking you,
Abstract
• We made an interactive game based upon the classic game
brick breaker. The object of brick breaker is to break the bricks
that are distributed around the top of the game screen.
• The bricks are broken after coming in contact with a ball
that bounces around the screen. At the bottom is a paddle
that in the classic game moves based on user input.
• The user has to make sure the ball bounces off the paddle without
going off the bottom of the screen.
• In our implementation, we use arrow keys to control the paddle’s
position, we use to track the position of an actual PingPong
paddle held by the user.
• The control of the game paddle improves the user experience.
Introduction
• This game is a brick ball game that needs to break bricks on the top
using one balls. In this game you need to handle one bottom bricks
with your arrow keys.
• If the game ball touches the bottom area then the game will be over.
You should try your best to complete all the levels.
• This game will provide you the intermediate file to create your own
game levels as many as you want. You can challenge your friend by
creating complicated game levels.
• We chose the game brick breaker because it is already a fun game
that we knew we could improve using an actual Ping-Pong paddle.
• The actual paddle made the game more interactive and allowed us to
take the users’ instinctual movements to allow for a better user
experience, in much the same way that current generation video
games are employing the technology (e.g. Microsoft Kinect,
Nintendo Wii, PlayStation Move). Our game was designed to be retro
and fun.
• It will help to accelerate your practical understanding. This game
development project will give you java knowledge with integration
and basic animation techniques. You can find this link for more game
development courses and projects. We always help you for better
understanding and knowledge.
Scope and Objective
Some of you already know about the brick breaker game. It has a small
ball that hits the bricks with the help of a little platform at the bottom. The
player uses this platform to bounce the ball. The more you break the
bricks, the more you score. If you miss the ball to bounce then game over.
This project is for beginners and gives a basic overview of the game. It
will definitely help you with your first-year project or as a fun purpose
implementation. The following are the milestones of the project
implementation.

1.Display bricks and disappear after hitting the ball.


2.Small platform moving left and right
3. The ball must bounce after hitting brick and platform at the
bottom 4.Score display
Concepts used
1. Java

Methodology:-
1 This is a java project so you can use the IDE like eclipse
and Net beans etc.
2 Initially, you have to create a frame for the game. For that create a
class called Main which contains the main method. Then create
boundaries by assigning the dimension. Along with this use JFrame
which is a built-in class for the minimize and close functions.
Import Jframe package also.
3 Next, create a Run game class and extend it with
JPanel. Import JPanel package also.
4 Use keylistener and action listener packages. KeyListener
for moving the small platform with arrow keys and
ActionListener for moving the ball. Add an unimplemented
method for it.
5 Mention the initial location of the slider or platform along
with ball location and direction with x and y axis.
6 Then create Rungame() constructor for calling the methods
for the timer, keylistener, and many more.
7 Create a function shapes() which include the graphics of
ball, bricks, and slider. It also includes a background color.
8 Use setColor() for background color and fillRect()
for boxes. Continue this for all other shapes.
9 Then assign the limitations in key events for the movement
of the slider so that it does not go out of the border.
10 Enter code in actionPerformed event for the movement of the
ball. You can use the if a condition for that if the ball collides
with boundaries or sliders, it will bounce.
11 The next step is to create bricks and actions related to bricks.
Create a Brick class. Insert condition in the function so that the
call interacts with the brick boundary then it will bounce along
with the vanishing brick. Don’t forget to create a background
colored border to the bricks for an individual break.
12 Create a loop for calculating score after every interaction
of brick and ball..
13 The final step is what makes you fail and win the game. If
all bricks disappear then the player Won the game by displaying
a title as WON!!!. And if the ball touches the lower boundary
the player fails with the display of GAME OVER.

So this is the step for the implementation of the game.Kit required to


develop Brick Breaker Game development project:
JAVA

Technologies you will learn by working on Brick Breaker Game


development project:
JAVA

Game development
Brick Breaker Ultimate minimum requirements
• Memory: 1 GB.
• Graphics Card: Intel Media Accelerator 500.

• CPU: Intel Pentium 4 2.00GHz.

• File Size: 50 MB.

• OS: Windows 7/8/10 – 64bits.

• Operating System
• Java SDK or JRE 1.6 or higher
• Java Servlet Container (Free Servlet Container available)
• IDE ( Intellij Idea )
Feasibility Study

Feasibility study is one of stage among important four stages of Software Project
Management Process. As name suggests feasibility study is the feasibility analysis
or it is a measure of the software product in terms of how much beneficial product
development will be for the organization in a practical point of view. Feasibility
study is carried out based on many purposes to analyze whether software product
will be right in terms of development, implantation, contribution of project to the
organization etc.

In Technical Feasibility current resources both hardware software along with


required technology are analyzed/assessed to develop project. This technical
feasibility study gives report whether there exists correct required resources and
technologies which will be used for project development. Along with this,
feasibility study also analyzes technical skills and capabilities of technical team,
existing technology can be used or not, maintenance and up-gradation is easy or
not for chosen technology etc.

Economic Feasibility

In Economic Feasibility study cost and benefit of the project is analyzed. Means
under this feasibility study a detail analysis is carried out what will be cost of the
project for development which includes all required cost for final development like
hardware and software resource required, design and development cost and
operational cost and so on. After that it is analyzed whether project will be
beneficial in terms of finance for organization or not.
Operational Feasibility

In Operational Feasibility degree of providing service to requirements is analyzed


along with how much easy product will be to operate and maintenance after
deployment. Along with this other operational scopes are determining usability of
product, Determining suggested solution by software development team is
acceptable or not etc.
FlowChart
Collision Detection

Collision detection was perhaps the most difficult section of this


project. During the processing stage, each moving object must
determine if its area has overlapped that of another object. Since the
ball is the only object which can hit any other object, these collision
detections are always done in terms of the ball. The ball can hit any of
the four walls (the bottom wall causing a death), any edge of any
brick, or the top of the
paddle. Each object is defined in code as a struct, with members such
as .left, .right, .top, and .bottom. The ball’s sides are compared with
that of all other objects to check for an overlap. To save time, only
those collisions which are currently possible given the state of the ball
are processed. For example, if the ball is moving up and to the right,
only the left and bottom sides of the bricks are checked. Below is a
code snippet showing the code used to determine if the ball has hit the
right side of any brick.

The bricks are stored in a two dimensional array, and a pair of for loops iterate
through every one. A conditional ‘if’ statement determines if the ball’s left edge
has gone past the brick’s right edge. It also checks to make sure that the ball is in
the same Y zone as the brick. The figure below shows the X zone and Y zone of
the brick, as well as the left and right edges of the ball and brick, respectively. It
also shows how the ball must bounce off the brick at the same angle it enters. For
example, if the ball hits the brick at a 45 degree angle, it must bounce off the brick
at a 45 degree angle. This is done by simply changing the sign of the X speed
variable of the ball (ball.xSpeed = - ball.xSpeed;). All collisions with vertical
barriers change the XSpeed in the same way, while all horizontal barriers change
the sign of Y speed

The only exception to the bouncing rule is the paddle. In order to give
the user control over the ball, the paddle has six different hit zones.
Each zone bounces the ball off at a different, set angle, regardless of
the pre-bounce angle of the ball. The figure below shows each of the
six zones and the direction the ball bounces off of it, with a table
showing the new X and Y speeds for each zone.

System Analysis

As depicted in the flowchart below, the program starts by doing all of


the necessary configuration and drawing the first level. After that, the
program goes into a pause stage, where it first turns the LED to
yellow, shows the current and high scores, and waits for the player to
hit the un-pause button. While waiting for the player, the program
also checks for a reset code that will reconfigure and redraw the
entire screen in case of random glitch errors. Once the player is ready,
the LED goes green and the game begins with the Detect Collisions
section.

Firsts the program checks to see if the ball has run into any edges of
the screen. If the ball has hit a bottom wall, the speaker plays the
losing sound beeps and the gameplay variables are reset. If the player
has beaten the high score then the new high score is saved to memory
and the program goes to the pause stage so that the player can see
their score compared to the old high score. If they did not beat the
high score then the program still takes them to the pause screen so
that they can see what their score was compared to the current high
score. If the ball hit the right, left, or top wall then the X and Y speed
are adjusted accordingly and the speaker plays the wall beep sound.

If the ball is not near the paddle or near the bricks, then the program
goes on the Move stage. If the ball is near the paddle, the program
checks to see if the ball has hit the paddle. If the ball did hit the
paddle then it adjusts the X and Y speed as well as the bounce angle
accordingly and the speaker plays the paddle beep sound. If the ball
has not hit the paddle then the program goes on to the Move
section.

If the ball was not near the paddle but was near the bricks then the
program checks to see if the ball has hit any bricks. If the ball did hit
any bricks then it adjusts the X and Y speed accordingly and the
speaker plays the brick beep sound. If the ball has not hit any bricks
then the program goes on to the Move section.

For the Move section, the ball position is always updated based on its
X and Y speed, but the paddle position is only updated if any of the
four movement buttons were
pressed. The program then waits for a timer to expire and redraws the
ball and the paddle, if the paddle has moved.

Lastly, the program checks to see if the level has been beaten. If so,
it increments the level number, increases the game-play speed, and
redraws the bricks. Finally, it checks to see if the pause button is
being pressed. If so, it enters the pause function showing the player's
current score and the high score until the player is ready to play
again. If the pause button was not pressed then the program just
starts over at the Detect Collisions section.
Proposed System

This section will discuss the basic software design of the game,
which follows a fairly straightforward cyclical procedure of four
basic stages.
4.4.1 Pause. This is the initial state of the game. The game also
returns to this stage anytime the user presses the pause button.
In it, a portion of the screen is overwritten with a textual
printout of the user’s current score and the high score as seen in
Fig 2b. Each character of the printout is stored in program
memory as a two dimensional char array, with a value of 1 for a
white pixel and a value of 0 for a black pixel. These arrays are
iterated and each pixel is transmitted to the LCD using the SPI
module. The user’s score is stored in local memory, and is
incremented each time the ball breaks a brick, with higher level
bricks being

worth more points. The high score is stored in the Tiva-C microcontroller’s
onboard EPROM module. Since this is non-volatile memory, the high score
can persist through power cycles. At the time of a loss, if the user’s current
score is greater than the high score, the user’s score is written to EPROM as
the new high score. The pause function also takes care of the two color LED
on the
controller. Whenever the game is paused, the LED lights up
orange. When the game is in active play mode, the LED lights
up green.
4.4.2 Process. This is the stage in which the current state of the
game (in this case just the positions of each object) are
processed. The largest portion of this stage is consumed by
collision detection, which will be discussed in greater detail in
section 4.5. This stage also monitors the pause button
(returning to stage 1), as well as handling level advancing and
game loss.
4.4.3 Move. In this stage, each moving object has its position
updated according to its speed. The ball’s position on the X and
Y axis will increment by its XSpeed and YSpeed. Its direction
of travel is determined by the ratio of these two
speeds. For example, if the ball has an XSpeed of 2 and a
YSpeed of 1, the ball will be moving at a shallow angle up and
to the right. In addition, the paddle’s position on the X axis will
increment by its XSpeed. While the ball’s position always
changes, the paddle’s position only changes when the user is
pressing the left or right movement buttons. Depending on
which button is pressed, the paddle will move by its XSpeed in
either a positive or negative direction. The paddle can also be
moved in jumps. If the user is pressing the jump left or jump
right buttons, the paddle’s position will change to the far left or
far right of the
screen. All of these buttons, as well as the pause button and a
two color LED, are located on a small PCB connected to the
microcontroller with a bundle of
wires. Fig 3a shows a picture of active gameplay using this controller.
4.4.4 Redraw. In this stage, objects which have changed
position or state are redrawn. Usually, this only means that the
ball is moved. To move the ball, its old position on the LCD
must be written black, and its new position must be written
white. This provides the illusion of motion on the screen. The
paddle is composed of a white bar with two narrow strips of
black on either end. These black strips are not visible, but
succeed in covering up the trail of white that the paddle would
otherwise leave without a full overwrite of the paddle area.
This is not effective when the jump buttons are used, so the old
position of the paddle must be overwritten in that case. Bricks
which have been broken are also written black. Although it
would be easier to rewrite the entire screen in the redraw
phase, this partial redraw method saves a lot of LCD time,
making the moving objects seem more fluid and the bricks
more static.

After each cycle of these stages, the microcontroller waits for a timer
to expire before repeating the process. This allows the movements to
happen at a consistent rate despite changes is processing time for
stage 2. The speed of the game can also be increased by lowering the
expiration time of this timer, down to a certain threshold. Luckily,
that threshold proved to be well above the maximum speed that a
human user could conceivably play the game.
Screenshots
Conclusion

This game is based on Java that is an object-oriented programming language.


It is a general-purpose programming language, mainly designed to run
developed java code on all platforms that support Java without recompilation.
As we all know, Java is one of the most popular and in-demand programming
languages to learn and it was one of the first languages to standardise high-level
threading utilities.
Java project is a must for aspiring developers. This project helps developers
develop real-world projects to hone their skills and materialise their theoretical
knowledge into practical experience. Java has significant advantages both as a
commercial language and also as a teaching language. Java project provides
rigorous compile-time error checking typically associated with Pascal,
allowing instructors to introduce students to GUI programming, networking,
threads, and other important concepts used in modern-day software. Overall,
the java project gives a complete design for the extended language.

Inspiration
I'm good at Java so i came into thought creating a simple game . So first
question on my mind was which game should i develop ? so there was a game
which i really enjoyed playing and which i really like is brick breaker . i used
to play brick breaker game on gaming console back then . then it came into
thought that why not to build this game lets do it.

What it does
it is simple program you may run on you machine where there's a ball and plate
and bricks above. you need to move plate horizontally according to
judgement that ball should not miss the plate after breaking the above bricks
block of the window . if it misses game is over .

How we built it
i built it using netbeans ide , and intellij idea for demo .
Challenges we ran into
game was preety easy to code , but the challenge i faced was the logic used to
build the game which was quiet difficult part .

Accomplishments that we're proud of


good coding skills developed .
What we learned
brushed up java skills.

You might also like