Brick Breaker
LiveA browser brick breaker with a boss fight, built on a plain canvas
Role: Solo developer
Solo · Since Sep 2026 · Public repo
Started as a 30-minute technical assessment, then finished properly: six levels ending in a boss that patrols behind metal bricks, six power-ups (lasers and a fireball among them), combo scoring and a top-5 scoreboard. No game engine and no audio files: sound effects are synthesized in the browser.
Problem
The first version moved the ball a fixed distance per frame, so it ran more than twice as fast on a 144Hz monitor as on a 60Hz one. And collision code in a canvas game is easy to get subtly wrong: balls stuck inside bricks, or bounced back into a brick they were already leaving.
Solution
Physics runs on a fixed 120Hz step regardless of frame rate, and all collision, bounce and scoring logic lives in a DOM-free module with unit tests. One test sweeps a grid of positions around a brick to check that the corrected position never still overlaps it.
Architecture highlights
- Fixed-timestep physics: same speed on 60Hz and 144Hz screens, and no tunneling at top speed
- Levels defined as plain strings ('.' empty, '1'-'3' hits, '#' metal), each one checked by a test to be clearable
- Saved scores treated as untrusted input: validated on load and rendered as text, never HTML
- Playwright tests on desktop and mobile covering the boss fight, power-ups and the scoreboard
- Built for phones too: touch drags the paddle relatively so the thumb never hides the ball, and reduced motion turns off screen shake