Star Defender
A space shooter that runs in the browser, built on HTML Canvas.
This one started as a test: the first thing I ever shipped to AWS, mostly to see a page come out the other end of S3 and CloudFront. It still runs, so it stays.
What’s inside:
- One file, no build. A single ~10 KB
index.htmlwith no framework and no dependencies. - Everything is drawn by hand. The ship, the invaders, bullets, explosions and the
scrolling starfield are canvas paths and rectangles. The glow is just
shadowBlur. - A classic game loop.
requestAnimationFramewith delta time, capped so a background tab doesn’t make everything jump when you come back. - Sounds without audio files. Every beep is synthesized on the fly with Web Audio oscillators.
- Keyboard and touch. Arrow keys or A/D on desktop; on a phone you drag to move and it fires automatically.
- It gets harder. Each wave brings more and faster invaders. From wave 3 on, tougher ones need three hits, and there’s an occasional rapid-fire power-up.