Breakout

Canvas brick breaker · 8×4 grid · fixed 60 Hz

BOOTING — FPS SOUND ON
CRT-400 · 60 HZ 0 / 32 CLEARED

Drag anywhere on the screen to slide the paddle · tap to launch · hold the pads below for thumb control

Build sheet / vanilla js + canvas

Field
400 × 600 logical canvas, backing store scaled to devicePixelRatio (capped 2.5×)
Grid
8 × 4 bricks, 50 × 20 px, hung 52 px below the score rail so the HUD never sits over a brick
Paddle
60 × 10 px at y = 580, clamped to 0 – 340 px
Ball
r 3, spawns at (200, 570), vector (2, −2.8) normalized — never straight up
Speed
3.44 → 3.95 px/frame, renormalized after every reflection (stays inside 3–4)
Loop
accumulator on requestAnimationFrame — identical physics at 60 or 120 Hz
Scoring
+10 per brick · 320 max · 3 lives · best run saved locally
01

Separated-axis AABB

Each substep moves X, resolves every left/right face, then moves Y and resolves top/bottom. The face is picked from the ball's nearest point on the rect, so brick hits flip the correct axis instead of jittering.

02

Substepping + nearest-hit only

Movement is split into ≤1.2 px steps, and only the deepest overlap is resolved per step. A brick dies the instant it is hit, so it can never re-collide — no sticking, no tunnelling, no ploughing through a row.

03

Paddle steering

Contact angle maps −1…1 across the paddle to ±60°, so edge hits skim sideways and centre hits go flat up. Paddle momentum carries a little spin into the ball; horizontal share is capped so it can never grind sideways forever.