About Brick Breaker Game on Scratch:
Brick Breaker Scratch Game involves the player bouncing a ball off of the paddle, and hitting bricks. If the ball hits bricks, then they disappear. The game is won when all of the bricks disappear and the game is lost if the player misses the ball.
We only need 4 sprites for this game – Paddle, Ball, Line and Bricks
Lets Sketch out the Brick Breaker Game on Scratch:
- Make the paddle that moves left and right with mouse.
- Make the ball
- bounces off the walls
- bounces off the Paddle
- bounces off the Line
- Make Clones of Brick
- Make the Brick disappear when ball touched.
Brick Breaker Game on Scratch Code
Make the paddle controlled with the mouse.
Paddle can be controlled either using mouse or keyboard. The paddle is pretty easy to code, just a couple of simple instructions.
- Make sure the paddle moves with the mouse.
- If the mouse moves left, the paddle should move left, similarly, if the mouse moves right, the paddle should move right.
- Alternatively, arrow key on keyboard can also be used to control the paddle.
- If the left key is pressed, the paddle should move left, and if the right key is pressed, the paddle should move right.
Tip: If the paddle hits the ball, make it smaller to make the game harder!
Place the ‘Line sprite’ at the bottom of the screen. Make sure it covers the whole stage, but is completely below the paddle.
Make the ball Bounces off:
This is the difficult bit now. But also the bit where the game starts to come together.
Click to select the Ball sprite. Insert the pick random block and type in -75 to 75.
you’ll make the ball sprite bounce around the screen.
A. Bounce Off the Walls: Make the ball bounce when it hits an edge using the ‘If on edge bounce’ block.
B. Bounce Off the Paddle: Make the ball bounce,When the ball hits the paddle.
C. Bounce Off the Line: Every time the ball touches the ground, one life is lost. If the ball touches the Line 3 times, stop the game completely!
Make Clones of Brick
Brick Breaker game needs lots of bricks.
One way to do this is to get one block working, and then just copy and paste your working block to make more! Lots of work.
Another easy way of making more copies is through Cloning.
Cloning should be used whenever a project should have many similar sprites doing similar things. Create one Brick sprite and then clone it using ‘create clone of myself’ block from “Control”.
Steps involved in creating Clones:
- Move the original brick sprite to the top-left corner of the Stage.
- The repeat 14 block repeatedly moves 30 steps to the right while making clones of itself, resulting in a row of 14 Brick clones.
- The repeat 8 block repeats the row-creating code to create 8 rows of Brick clones.
- 14 Brick clones in a a row multiplied by 8 rows results in total 112 Brick clones.
- After all the clones have been created, the original sprite hides itself.
Imagine if you duplicated the sprites instead of cloning them. Then, if you wanted to change the code or color, you’d have to change it to all 112 Brick sprites. Cloning saves you a lot of time!
Make the Brick Disappear When Ball Hits
The bricks are pretty simple to program – they only need to do two things.
- When the green flag is clicked, show itself.
- Forever, check if it is touching the ball. If it is, then hide itself.
The brick should appear at the start of the game and disappear when the ball touches it. Keep “score”, which will increase by 1 when the brick is hit by the ball.
Winning and Losing Condition For Backdrop
Always start the game with our main background by adding this code to the backdrop
Insert the Lives block into the equals block from the Operators category. Type the number of lives needed to lose the game.
When the number of lives reaches 0, the game will stop and display a Game Over Screen.So let’s first create a new Game Over backdrop:
Insert the Score block into the equals block from the Operators category. Type the number of points needed to win the game.
When the number of score reaches 112 (Total number of brick), the game will stop and display ‘You Win” Screen.
Download Brick Breaker Scratch Game Project files
To download the project files of the project How to make Brick Breaker Game on Scratch Click here. Also go through the another ineresting scratch 3.0 project of Animate Your Name using scratch 3.0 here,