Browser recreation of the 1978 Taito arcade classic. Single HTML file, no dependencies, no build step.
Play: https://invaders.petrochenko.info
Part of the retro arcade collection: Tetris | Pac-Man | Space Invaders
Every mechanic has been verified against the original 1978 Taito cabinet:
| Row | Type | Points | Sprite |
|---|---|---|---|
| Top | Squid | 30 | 8px, 2-frame animation |
| Middle (2 rows) | Crab | 20 | 11px, 2-frame animation |
| Bottom (2 rows) | Octopus | 10 | 12px, 2-frame animation |
- Formation moves as a unit: step right 2px until ANY invader hits the edge, then drop 8px and reverse
- Speed scales with remaining count -- 55 alive = slow, 1 alive = extremely fast
- Each step plays the next note in the iconic 4-note march bass loop (C3-B2-Bb2-A2)
- Horizontal movement at 2px/frame, clamped to screen edges
- 1 bullet on screen at a time -- cannot fire until previous clears (core skill mechanic)
- Bullet speed: 5px/frame upward
- 3 visually distinct types: rolling (alternating dots), plunger (cross shape), squiggly (animated zigzag)
- Max 3 on screen simultaneously
- Speed: 2px/frame downward
- Weighted targeting -- columns closer to the player fire more frequently (not random)
- Bullet-bullet collision -- player bullet and invader bullet destroy each other on contact
- Pixel-level erosion: player bullets erode from top, invader bullets from bottom
- Invaders walking through shields destroy overlapping pixels
- Shields reset each new wave
- Appears every ~25 seconds, crosses the top of the screen
- Alternates left/right direction
- Scoring based on shot count (deterministic, not random): cycles through 100/50/50/150/100/100/50/300
- Score popup displays briefly at hit position
Advanced technique from the original arcade:
- When bottom-row invaders descend near player level, their bullets cannot hit the player (spawn point below player hitbox)
- Game over only triggers when invaders reach the green ground line, not the player row
- Enables the "wall of death" strategy: keep bottom row alive, farm UFO bonuses safely
- 3 lives, extra life at 1,500 points (once only)
- Direct invader-player contact kills the player
- Game over: all lives lost OR invaders reach ground line
- High score persisted in localStorage
- Infinite waves, shields reset each wave
- Each new wave starts 8px lower (capped at Y=88)
- No "level complete" -- continuous escalation
The original cabinet used colored cellophane strips over a black-and-white CRT:
- Red (top) -- UFO and score area
- White (middle) -- invader play area
- Green (bottom) -- shields, player, ground line
Recreated with subtle alpha overlays.
| Action | Desktop | Mobile |
|---|---|---|
| Move | Arrow keys / A, D | LEFT / RIGHT buttons |
| Fire | Space | FIRE button |
| Pause | Esc / P | -- |
| Help | H | Tap help overlay |
D-pad is always visible (works with Bluetooth keyboard connected to phone).
All synthesized via Web Audio API, no audio files:
| Sound | Implementation |
|---|---|
| March loop | 4-note square wave (C3/B2/Bb2/A2), tempo synced to invader speed |
| Player shoot | 1200-200Hz descending square chirp |
| Invader death | 800-100Hz sawtooth crunch |
| UFO siren | 400+/-200Hz oscillating sine (while visible) |
| Player death | 600-40Hz sawtooth descent (1.7s) |
| Extra life | 4-note ascending staircase (A4/C#5/E5/A5) |
- Rendering: Canvas 2D API with pixel art sprites (2D arrays)
- Audio: Web Audio API synthesizer
- Hosting: Cloudflare Pages
- Size: Single
index.html(~1,600 lines), zero dependencies
| Device | D-pad Size | Notes |
|---|---|---|
| Small phone (< 380px) | 52px | Compact |
| Medium phone (420px+) | 62px | Standard |
| Large phone / tablet (480px+) | 74px | Comfortable |
| Desktop | 52px + keyboard hint | Both input methods available |
npx wrangler pages deploy . --project-name space-invaders --branch main --commit-dirty=trueEverything lives in index.html (~1,600 lines):
- CSS -- responsive layout, overlays, D-pad, color scheme
- HTML -- canvas (224x256), score header, lives row, overlays (start/gameover/help), D-pad
- Sprites -- pixel art as 2D arrays: player, 3 invader types (2 frames each), UFO, explosions
- Constants -- dimensions, speeds, shield template, UFO score table
- Game State -- score, lives, wave, entities, timers, shot counter
- Entity Creation -- player, invader formation (5x11), shields (4 bitmaps), UFO
- Movement -- player (clamped), formation (step/drop/reverse), UFO (timed), bullets
- Collision -- AABB for bullets/invaders/UFO, pixel-level for shields, bullet-bullet, invader-player contact
- Shield System -- per-shield bitmap, directional erosion, invader overwrite
- Scoring -- per-type points, shot-count UFO cycle, extra life at 1500
- Drawing -- sprites, shields from bitmap, 3 bullet types, color overlays, explosions
- Input -- keyboard (arrows/WASD/space), D-pad (touch/pointer), pause (Esc/P), help (H)
- Audio -- Web Audio: march loop, shoot, death, UFO siren, extra life
- Game Loop -- fixed timestep (1000/60), accumulator, state machine (start/playing/paused/dead/nextwave/gameover)
21 mechanics verified against 1978 Taito specs: 21/21 match.
| Category | Mechanics Verified |
|---|---|
| Movement | Player clamping, invader step (2px), drop (8px), edge reversal, speed scaling |
| Bullets | 1 player bullet, 3 invader max, 3 visual types, weighted targeting, bullet-bullet collision |
| Shields | 4 bunkers, pixel erosion (directional), invader overwrite, wave reset |
| UFO | 25s timing, alternating direction, shot-count scoring, score popup |
| Scoring | Per-type points, extra life 1500, contact kill, Nagoya shot |
| Audio | March sync, UFO siren, shoot/death/extra life sounds |
| Visual | Color overlays, sprite animation toggle, score padding |
For educational purposes. Space Invaders is a trademark of Taito Corporation / Square Enix.