Breakout

Cabinet 8×4 · 32 blocks · one ball, three lives

StateREADY
Score000
Lives3
Blocks32
400×600 · Canvas 2D 60 FPS

Drag / move: paddle←→ or AD Space launch · P pause · R restart

Operating notes

Four rows. Eight columns.
One clean bounce at a time.

  1. Aim with the paddle edge

    Hit the ball left of centre and it leaves left — the further from the middle, the steeper the exit angle (max 65°). Paddle motion adds a little spin.

  2. One collision per frame

    When the ball overlaps two blocks, only the deepest penetration resolves. The reflection axis comes from the overlap on each axis, so sides flip dx and faces flip dy.

  3. Speed climbs, never breaks

    Every block nudges the magnitude up by 0.03, hard-clamped between 3.00 and 4.00 px/frame. Reflections only flip signs, so magnitude is always preserved.

  4. The walls are part of the paddle

    The play field is exactly 400px wide and the paddle's travel is clamped to 0–340, so a ball can never slip behind the paddle. Side impacts bounce off the paddle's ends.

  5. Touch works both ways

    Drag anywhere on the screen and the paddle eases toward your finger. The canvas scales down to 320px viewports and fits landscape phones without scrolling.

Build

Stack

  • RenderingHTML5 Canvas 2D
  • Librariesnone
  • AudioWebAudio oscillators
  • LooprequestAnimationFrame
  • Spritespre-rendered offscreen
  • Inputpointer · touch · keys
  • Best run0

BREAKOUT · cabinet 8×4 buildtip: clear a full row for a flash of the field320px+ · portrait & landscape