Mouse / arrows / A-D · drag on touch · SPACE launches · P pauses · R resets
Mouse / arrows / A-D · drag on touch · SPACE launches · P pauses · R resets
ENGINE NOTES / COLLISION MODEL
The ball is treated as a square [x−r, x+r] × [y−r, y+r] against each brick rect. Overlap is measured on both axes, so contact never depends on the centre point crossing an edge.
If overlapY < overlapX the ball entered through the top or bottom — flip dy. Otherwise it entered through a flank — flip dx. The ball is then pushed flush to that face, so it can never be re-absorbed by the same brick.
Movement is split into substeps of ≤2px and only the shallowest (nearest) overlapping brick is resolved per substep. Corner-brick clusters and tunnelling through 20px rows both die here.
Every bounce rebuilds the vector from the angle and the current magnitude, so energy never drifts. Anti-stall guards clamp the trajectory away from pure vertical and pure horizontal.