Breakout Brick Breaker: 8 Levels, Power-Ups and Combos
Breakout Brick Breaker · Games · Plain HTML, CSS & JS · Live preview
For supporters
Source Code
Want the source code?
Play the game for free. Become a WebDevPuneet supporter to unlock the complete HTML, CSS and JavaScript source code, the exports (HTML, React, Vue, Angular, Tailwind) and Fork.
Extend with AI
Take This Snippet Further With AI
The AI prompt for this one is for Patreon supporters ($3 a month), along with a site with no ads. Supporters enter the passcode once and it is remembered in this browser.
What's included
Features
About this UI Snippet
Breakout: Designed Levels, Special Bricks, Seven Power-Ups and Tunnel-Free Ball Physics

Breakout is the classic paddle-and-ball brick breaker: keep the ball in play with your paddle and knock out every brick to clear the level. This snippet builds a complete version on one HTML5 <canvas> with no libraries and no image files: eight hand-designed levels, four kinds of bricks, seven power-ups, combos, and a save that lets you continue from the furthest level you reached. It plays with the mouse, a finger dragged on the board, or the arrow keys or A and D, and you launch the ball with a click, a tap or Space.
Levels drawn as text
Each level is an array of strings in the LEVELS list, one character per brick: 1, 2 or 3 for how many hits a brick needs, S for unbreakable steel, X for an explosive brick, P for a power brick that always drops a capsule, and a dot for a gap. The eight levels (Warm-up, Pyramid, Fortress, Checkers, Invader, Steel Maze, Diamond and Final Wall) introduce the special bricks one at a time. A level is cleared when every breakable brick is gone, which pays 500 points times the level. After level 8 the layouts repeat as a new round with a faster ball, and the highest level you reached is saved so the menu can offer "Continue".
Ball physics that never skip a brick
The ball moves in small sub-steps of at most three pixels per frame, so even at top speed it cannot pass through a brick between frames. Each sub-step tests the ball as a circle against each brick's rectangle and, on contact, pushes it out along the axis with the smaller overlap and reverses that component of the velocity, which gives clean bounces off sides and corners. Where the ball meets the paddle decides the bounce angle (the edges send it out wide), the paddle's own movement adds a little spin, every paddle hit speeds the ball up slightly up to a cap, and a minimum vertical speed stops it from sliding sideways forever.
Special bricks and power-ups
Tough bricks show pips for their remaining hits and crack as they are damaged. Steel bricks ring when hit and only bounce the ball. An explosive brick destroys the eight bricks around it, so a well-placed hit can set off a chain reaction. Broken bricks drop a capsule 11% of the time (power bricks always do): W widens the paddle, M splits into three balls, L mounts auto-firing lasers, S slows the ball, F turns it into a fireball that smashes through bricks without bouncing, ♥ is an extra life, and the grey − capsule shrinks your paddle, so not every capsule is worth catching.
Combos and juice
Bricks broken without the ball touching the paddle build a combo, and every four raise the multiplier up to x4. Bricks burst into particles, explosions shake the screen, the ball leaves a glowing trail (orange as a fireball), and each level opens with a banner. Sounds rise in pitch with the combo and are made with the Web Audio API, with a mute button. The game pauses on P, the pause button or a tab switch, and the best score is kept in localStorage.
Step by step
How to Use
- 1StartPress New Game, or Continue to resume from the furthest level you reached. Move the paddle with the mouse, by dragging on the board, or with the arrow keys or A and D.
- 2Launch and aimClick, tap or press Space to launch the ball. Where it hits the paddle sets the angle: the centre sends it straight up, the edges send it out wide.
- 3Know your bricksDots on a brick show how many hits it still needs. Grey steel bricks cannot be broken. Red ✸ bricks explode and destroy their neighbours. Gold ? bricks always drop a power-up.
- 4Catch the right capsulesW widens the paddle, M gives three balls, L adds lasers, S slows the ball, F makes a fireball and ♥ is an extra life. Avoid the grey − capsule, which shrinks your paddle.
- 5Build combosBreak several bricks before the ball returns to the paddle. Every four bricks raise the multiplier, up to x4.
- 6Clear all eight levelsClear every breakable brick to finish a level and earn a bonus. After level 8 the levels repeat faster. Press P to pause.
Real-world uses
Common Use Cases
Got questions?
Frequently Asked Questions
Add an object to the LEVELS array with a name and a map of strings, each up to 10 characters wide. Use 1, 2 or 3 for bricks that need that many hits, S for steel, X for an explosive brick, P for a power brick and a dot for an empty space. A level ends when no breakable bricks are left, so steel bricks never block completion.
Each frame the ball's movement is split into sub-steps of at most three pixels, and collisions are checked after every sub-step. Because the ball radius is six pixels, it can never jump past a brick edge between checks, however fast it moves.
The bounce angle depends on where the ball hits the paddle, from straight up at the centre to about 60 degrees at the edges. Moving the paddle as the ball hits adds a little extra angle, and each paddle hit increases the ball speed by about one percent, up to 35% above the level's base speed.
W makes the paddle wider for 12 seconds, M adds two extra balls, L fires lasers from the paddle for 9 seconds, S slows the ball for 8 seconds, F makes the ball smash through bricks for 6 seconds, ♥ adds a life, and the grey − shrinks the paddle for 8 seconds. Losing your last ball clears all active power-ups.
Every brick hit by a ball before the ball touches the paddle again adds to the combo. The score multiplier is 1 plus one for every four bricks in the combo, up to x4, and it resets when the ball touches the paddle.
Yes. The furthest level you reached and your best score are saved in localStorage, and the menu shows a Continue button that starts at that level with three lives.