HTML5 · Canvas 2D · no libraries

Breakout//Out

32 bricks, one paddle, three balls. Hand-written AABB collision with minimum-penetration side resolution, sub-stepped physics so a 4px ball never tunnels a 20px brick, and full touch drag for phones.

Ops manual

  1. Launch. The ball rests on the paddle — tap, click or press Space to fire it upward at roughly 54°.

  2. Use the edges. Contact point sets the rebound angle, up to ±62° from vertical. Paddle motion adds a little english.

  3. Chain hits. Speed climbs from 3.44 to 4.0 px/frame as the wall thins. A lost ball resets the streak.

  4. Clear all 32. 10 points each, 320 max. Three drops and it's game over.

Collision model

// one hit per substep, closest wins
for (br of bricks) {
  ox = min(r, brR) - max(l, brL);
  oy = min(b, brB) - max(t, brT);
  axis = ox < oy ? X : Y;   // smallest push
  if (pen < bestPen) best = br;
}
flip(bestAxis);                  // X→dx, Y→dy
push out by pen + 0.6;           // no sticking
// walls: reflect · paddle: angle from offset

Each 60 Hz tick is split into ceil(speed/1.8) substeps, so no brick is ever skipped and the velocity magnitude is preserved after every resolve.

Field spec

Canvas
400 × 600
Grid
8 cols × 4 rows
Brick
50 × 20 · +10 pts
Paddle
60 × 10 @ y580
Paddle range
x 0 – 340
Ball
r3 · 3.44 → 4.0 px/f
Lives
3
Max score
320
Loop
fixed 1/60 · rAF
Render
Canvas 2D, DPR-aware