Arcade cabinet · canvas 400×600 · vanilla js

BREAKOUT

32 bricks. One 3px ball. Three lives. The paddle's edge decides your exit angle — the middle is safety, the rim is risk. Hit the top row hard and the ball speeds up.

credits 01 ▮ press start
phosphor 8×4 · aabb · 60hz
drag / ← → · space to launch

Collision resolution notes

01

Paddle angle, not perpendicular

Ball bounces off the paddle center at 0° and up to ±62° at the rim. Exit vector = (sin θ, −cos θ) × speed, then the magnitude is re-normalized so hits never accelerate the ball.

02

Minimum-penetration axis

Overlaps are tested as AABB against the ball's 6×6 bounding box. The axis with the smallest penetration is the contact face: smallest vertical overlap flips dy, smallest horizontal overlap flips dx, and the ball is pushed out along that normal.

03

One contact per tick

Of every overlapping brick only the closest candidate is resolved, then the loop breaks — so the ball can never destroy a 2-wide slab in a single frame or jitter inside a brick. Speed magnitude is preserved through the bounce.

04

Fixed step, 2 substeps

Physics runs a fixed 60 Hz accumulator with 2 px substeps and a 5-step catch-up cap, so a 120 Hz phone, a throttled tab, and a laggy desktop all play the same game. |dy| is clamped ≥ 0.9 to kill infinite horizontal orbits.

05

Touch is relative

Drag deltas are applied from the paddle, not the finger, so the paddle never teleports under your thumb on tap. Paddle follows with a 0.35 lerp for momentum; keyboard overrides the target directly.