A fast, stylized Asteroids variant with glitching enemies, power‑ups, boss phases, and modernized architecture.
Serve over HTTP (ES modules don’t load via file://).
-
Python
python3 -m http.server 8000- Open
http://localhost:8000/asteroids.html
-
Node (optional)
npx http-server .ornpx serve .
- Move: Arrows or WASD
- Strafe: Q/E
- Shoot: Space
- Restart: R
asteroids.html— entry point (canvas + game code imports)src/input.js— keyboard statestate.js— global game state + UI updatesloop.js— requestAnimationFrame wrappercollision/spatialHash.js— broadphase grid for collisionsutils/pool.js— tiny object pool for particles/textbosses/registry.js— data‑driven boss selection
- Uses ES modules (no bundler needed for now).
- Spatial hash and object pools reduce CPU and GC pressure.
- Boss fights trigger after clearing each wave; health bar is centered.
- Split entities/rendering into modules (
ship,asteroid,draw/*). - Add object pools for bullets/missiles if needed.
- Optional: migrate to Vite + TypeScript for richer tooling.