Skip to content

This program is built to create a brick-breaker game, the game contains a small ball with a specific number of bricks at the top of the window, and a slider paddle to interact with the moving ball, to win in this game you need to break all the bricks with out missing the ball.

Notifications You must be signed in to change notification settings

LeenAouto/brick-breaker-game

 
 

Repository files navigation

brick-breaker-game

This program is a project of the course IT251, Under the supervision of Dr.Mashael AL-Shuail, 4th of December 2021.

requirements:

  1. JAVA Programming Language
  2. Programming Language Editor (I used Intellij IDEA Community)

About the Game

This program is built to create a brick-breaker game, the game contains a small ball with a specific number of bricks at the top of the window, and a slider paddle to interact with the moving ball, to win this game you need to break all the bricks without missing the ball.

Main.java


This file is built to create a window to display the game inside it "The red rectangle illustrate the frame window".

The Frame window

Gameplay.java


This file defines the interactions between the user and the game, the style of the components of the game, specifies when the game starts, ends and continues.
Also:

What happens if the user wins

//YOU WON! if the number of bricks are done
        if(totalBricks <= 0){
            play = false;
            ballXdir = 0;
            ballYdir = 0;
            //the style of the wining phrase
            g.setColor(new Color(102, 0, 102));
            g.setFont(new Font("serif", Font.BOLD, 30));
            g.drawString("YOU WON !, SCORE:"+score, 180, 300);

            g.setFont(new Font("serif", Font.BOLD, 20));
            g.drawString("Press 'Enter' to restart", 230, 350);
        }

You Won Phrase

What happens if the user loses

//GAME OVER "if the ball went down"
        if(ballposY > 570){
            play = false;
            ballXdir = 0;
            ballYdir = 0;
            //the style of the losing phrase
            g.setColor(new Color(102, 0, 102));
            g.setFont(new Font("serif", Font.BOLD, 30));
            g.drawString("GAME OVER, SCORE:" + score, 180, 300);

            g.setFont(new Font("serif", Font.BOLD, 20));
            g.drawString("Press 'Enter' to restart", 230, 350);
        }

Game Over Phrase

MapGenerator.java


This file creates the bricks and styles them. Bricks Map

note: the wibsite does not display large size videos, but you can download the output videos if you are interesrted from Output videos they will be downloaded easily.

Youtube Video Source

About

This program is built to create a brick-breaker game, the game contains a small ball with a specific number of bricks at the top of the window, and a slider paddle to interact with the moving ball, to win in this game you need to break all the bricks with out missing the ball.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%