BREAKOUTCANVAS BUILD · v1.0
FIELD 400 × 600
GRID 8 × 4 = 32
MAX SCORE 320

// ONE SCREEN, THIRTY-two BRICKS, THREE LIVES

Clear the grid
before the fifth miss.

A hand-rolled breakout: explicit AABB resolution, penetration-tested bounce axes, one collision per frame, and a paddle that returns the ball at wherever you catch it — ±60°, never straight up.

← →A / DSPACE — launch P — pauseR — restartDRAG — touch
BREAKOUT // CRT -- FPS

How the collisions resolve

NO ENGINE

01

WALLS

Position is clamped back inside the play rect, then only the axis perpendicular to that wall is mirrored — dx for the sides, dy for the ceiling.

02

PADDLE ANGLE

Hit offset from paddle centre is normalised to [-1, 1], mapped to ±60°, and the velocity vector is rebuilt at constant magnitude. Catch it on the corner and it flies out wide.

03

BRICK AXES

The brick AABB is inflated by the ball radius, penetration is measured on all four sides, and the smallest penetration picks the exit axis — top/bottom flips dy, left/right flips dx. Only the deepest overlapping brick is processed per frame.

04

ANTI-STALL GUARDS

After every hit the ball is pushed fully out of the brick, |dy| gets a floor so it can never crawl horizontally, and the vector is renormalised so speed stays inside the 3.4–3.9 px/frame band.

Spec sheet

CANVAS
400 × 600
GRID
8 cols × 4 rows
BRICK
50 × 20
PADDLE
60 × 10 @ y580
PADDLE RANGE
0 – 340
BALL RADIUS
3
SPEED
3.44 → 3.94
LIVES
3
PER BRICK
+10
SIM STEP
60 Hz fixed