←→ / AD or mouse · Space launch · P pause · R restart
touch: drag anywhere on the board to slide · tap to launch or restart
8 × 4 grid · 320 max · 3 lives · vanilla canvas
←→ / AD or mouse · Space launch · P pause · R restart
touch: drag anywhere on the board to slide · tap to launch or restart
For every brick the circle test runs against the closest point on the rect, then overlap on X vs overlap on Y decides the axis: shallow X overlap → flip dx, shallow Y overlap → flip dy. Corner hits resolve on the smaller penetration, so the ball never reverses on the wrong axis.
Each frame is split into two half-steps. Inside a step, only the single nearest candidate collision is processed and the ball is pushed flush against that surface — no double flips, no brick stacks absorbing the ball, no tunnelling through a 20px row.
After every bounce the velocity is renormalised to the constant magnitude and clamped between 9° and 59° off vertical. Paddle bounces derive angle from hit offset (sin/cos of up to 63°) plus a touch of paddle momentum, so edge hits skim and centre hits snap back up.