Cab-08 · Canvas Arcade
Vanilla JS · 0 dependencies · Single file · 60 FPS

Breakout

8 × 4 grid · 32 bricks · AABB collision

CAB-08
◀▶ Space move / launch

Collision model

Circle → AABB nearest-point test. The candidate with the smallest squared distance wins, so a multi-brick contact resolves exactly one collision per sub-step. The contact normal picks the axis, the ball is pushed out to the brick face, and a one-frame lock on the brick id stops re-collision inside the same tick.

const nx = clamp(ball.x, b.x, b.x + b.w);
const ny = clamp(ball.y, b.y, b.y + b.h);
if (dx*dx + dy*dy <= r*r) {
  |dx| > |dy| ? vx = sign(dx)*|vx|
              : vy = sign(dy)*|vy|;
}

Ball physics

Fixed 60 Hz step with 2 sub-steps, so speed stays identical on 120 Hz phones.

Initial |v|3.441 px/f Ramp cap4.000 px/f Ball radius3 px Paddle arc±60° Min |vx| floor0.32

Input map

Pointer drag Touch
Mouse follow Desktop
Move ← → / A D
Launch · pause Space
Pause P
Restart R
Mute M