// ONE SCREEN, THIRTY-two BRICKS, THREE LIVES
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.
NO ENGINE
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.
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.
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.
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.