Breakout

32 bricks · 3 lives · 400×600 · AABB

READY
drag to steer · tap to launch60 fps

Field notes

implementation details worth knowing

01

Side resolution via overlap depth

The ball's AABB is tested against every live brick; the axis with the smaller penetration decides the normal — so a shallow graze flips dx, a head-on drop flips dy.

02

One brick per frame, deepest wins

Corners that touch two bricks resolve only the closest collision, then the ball is pushed clear of that face. No re-collision on the same tick, no brick swallowing the ball.

03

Fixed 1/60 accumulator

Physics steps in constant 16.67 ms ticks with a max of 5 catch-up steps, so a 120 Hz phone and a 60 Hz desktop play identically. Speed magnitude never drifts — always renormalised after every bounce.

04

Paddle english

Contact offset maps to ±62° and paddle velocity adds a small lateral nudge. A minimum vertical component keeps the ball from locking into a flat horizontal bounce.

05

Speed window 3–4 px / tick

Starts at 3.4 and climbs 0.02 per destroyed brick, capped at 4.0 — the difficulty ramp lives entirely inside that band.