VECTORBREAK

Canvas brick breaker · 400×600 · vanilla js

booting fps 60 bricks 32/32 best 0

Drag the playfield on mobile · ←→ or mouse on desktop · Space launch · P pause · R restart

Under the hood

Small game.
Strict physics.

No physics engine, no dependencies — just a fixed 60 Hz simulation stepping a circle through a grid of axis-aligned boxes, four sub-steps at a time.

  1. Fixed timestep

    Accumulator loop drives update() at exactly 1/60 s, so behaviour is identical at 60 Hz and 144 Hz. Render runs free on requestAnimationFrame.

  2. Circle ↔ AABB

    The ball's bounding box is tested against every brick cell, then the contact point is clamped to the box and measured against the true radius — no sloppy square-vs-square guesses.

  3. Least-penetration resolution

    Smaller overlap decides the axis: vertical overlap flips dy, horizontal flips dx. The ball is also pushed clear of the brick so it can never tunnel or nest.

  4. One hit per step

    Of every cell touched in a frame, only the deepest is resolved — then the loop breaks. No phantom double-breaks, no lost velocity.

  5. Constant speed

    Magnitude is renormalised after every reflection and clamped to 3–4 px/frame, so a corner hit can't accelerate the ball into orbit.

  6. English on the paddle

    Contact offset maps to a bounce angle up to 55° off vertical, plus a whisper of paddle momentum. Centre hits still go straight up.

Simulation constants
ParameterValue
Canvas400 × 600
Brick grid8 × 4 · 50 × 20
Brick count32 · max 320 pts
Paddle60 × 10 @ y 580
Paddle travelx 0 → 340
Ball radius3 px
Ball spawn(200, 570)
Launch vector(+2.00, −2.80)
Speed clamp3.00 → 4.00 px/f
Lives3
Sub-steps4 / frame
Dependencies0