Asteroid Survival

A quick arcade game running right in the docs. Dodge the asteroids, survive as long as you can, and try to beat your high score.

Controls: Arrow keys / WASD to move. Click the game to focus it first.

How It Works

Same state-first pattern as the Pong demo:

  1. State — ship position/velocity, asteroid array, particle pool, score
  2. Update — physics (inertia + friction), spawning, circle collision detection
  3. Render — reads state and draws: twinkling starfield, neon ship with thrust trail, irregular polygon asteroids, explosion particles

Difficulty ramps over time — asteroids spawn faster and move quicker. The game stays fun because collision uses 80% of the asteroid radius, creating exciting near-misses.