top image
home  /  pages  /  tech tips  /  contact about

Brick Breaker / Breakout

Introduction

I enjoyed recreating Brick Breaker from a set of games called PC Arcade on an IBM PC 8086 that I played as a kid. I implemented my own version as part of learning PyGame. (I also built a pure HTML implementation.)

Downloads

Mac
Download: BrickBreaker.dmg
(The first time you try to run Brick Breaker on a Mac, you will get a warning about the app being developed by an unknown developer. Click on Cancel. If you trust this random stranger on the internet, then go to System Preferences → Security & Privacy → General tab, and click "Open Anyway", and click on "Open" in the window that pops up. Then try starting Brick Breaker again. Alternatively, follow Apple's instructions.)

Windows
Download: BrickBreaker.msi
(When trying to install, Windows may pop up an error saying "Windows protected your PC" or something along those lines. If you trust this random stranger on the internet, click on "More info" and then "Run anyway".)

Source
Download: brickbreaker.py
Instructions to run the code are at the top of the file, in comments.

Code is distributed under the MIT License.

Behavior

Move the paddle with left/right (or < and >). You can make fine paddle movements by holding the shift key. 'p' or Space (un)pauses the game. 'q' or Escape quits the game.

Different areas of the paddle cause the ball to bounce differently. Most of the paddle bounces as expected: symmetrically. But if the ball bounces on the close corner, it will bounce back to where it came from. If it bounces on the far corner, it will accelerate. A fast-moving ball can be slowed down again by bouncing it on the center of the paddle.

Defeating a level gains you a ball, but the game speeds up by 10%. There are a total of 21 levels. In the last 3 levels, the bricks are invisible.

Usage

You can play the game by (double-)clicking on it. If you are command line inclined, however, you can play around with the following options.

usage: brickbreaker [-h] [--nballs NBALLS] [--lives LIVES] [--level LEVEL] [--rows ROWS]
                    [--bricks BRICKS] [--paddle-width PADDLE_WIDTH] [--speed SPEED]
                    [--move MOVE] [--infinite] [--auto]

optional arguments:
  -h, --help            show this help message and exit
  --nballs NBALLS       # of balls
  --lives LIVES         # of lives
  --level LEVEL         level to start at
  --rows ROWS           number of rows
  --bricks BRICKS       number of bricks in a row
  --paddle-width PADDLE_WIDTH
                        width of a paddle in pixels
  --speed SPEED         ball speed
  --move MOVE           paddle move speed
  --infinite            infinite lives
  --auto                self play

in-game keys:
  left and right   : move paddle left and right
  < and >          : move paddle left and right
  shift + <move>   : move paddle a little bit
  space or p       : (un)pause game
  esc or q         : quit game

Acknowledgements

Many thanks to Maarten Hulshoff for the fond memories and for testing.

URL: https://thomer.com/games/brickbreaker/index.html
Copyright © 1994-2022 by Thomer M. Gil
Updated: 2020/04/25