
- 相同提示词一次生成
- 第一版结果直接采用不做修改
提示词:
You are an experienced game developer. Build a complete, polished Space Invaders game as a SINGLE self-contained HTML file.
## Scope discipline
Build exactly this game — don't add features, screens, or abstractions beyond what's listed. Do the simplest thing that works well. No frameworks, no build tooling, no future-proofing.
## Hard delivery constraints (these guarantee it runs anywhere)
- ONE file: `index.html` with all HTML, CSS, and JavaScript inline. No separate files.
- ZERO external assets and ZERO libraries: no image files, no audio files, no CDN links, no npm, no server. All graphics drawn on a Canvas; all sound synthesized at runtime with the Web Audio API.
- MUST run by double-clicking the file (file://) in current Chrome, Edge, Firefox, and Safari on Windows and macOS. Because it runs from file://, do NOT use ES modules (`type="module"`), `import`, or `fetch` — one plain `<script>`, everything inline.
- 2D Canvas only (no WebGL). Must hold 60fps on low-end integrated graphics.
## Gameplay (classic Space Invaders)
- Player cannon at the bottom: move with Arrow keys AND A/D; fire with Spacebar (single-shot cooldown).
- A 5×11 grid of aliens (3 sprite types) that march left/right in lockstep, drop down and reverse at the edges, and speed up as their numbers thin.
- Aliens drop bombs at random; player has 3 lives; a hit costs a life.
- 4 destructible bunkers that erode chunk-by-chunk from both player and alien fire.
- A bonus UFO that occasionally crosses the top for extra points.
- HUD: score, high score (persisted in localStorage), lives, wave number.
- Clearing a wave starts the next faster/lower; losing all lives shows Game Over with the score and a Restart (R / click). A Start screen lists the controls; play begins on keypress.
## Graphics ("good", lightweight)
- Crisp pixel-art sprites drawn from small pixel grids (filled rects) — no external images.
- Retro neon-on-black look: parallax starfield, subtle scanline/CRT vignette via CSS, glow on shots.
- Two-frame alien march animation; particle bursts on kills/bunker hits, with a hard particle cap so performance stays flat.
## Sound (Web Audio, synthesized — no files)
- Synthesize: player shoot, alien hit/explosion, player death, UFO warble, and the classic 4-note descending march loop that speeds up with the aliens.
- Mute toggle (M) with an on-screen speaker icon. Create/resume the AudioContext on first user input (autoplay is blocked otherwise).
## Engineering
- Fixed-timestep loop via requestAnimationFrame; separate update() from render() so speed is identical on every machine.
- Canvas scales to the window preserving aspect ratio; crisp pixels (`image-rendering: pixelated`, integer scaling).
- Handle simultaneous keys and rapid input without stuck movement; pause on window blur. No runtime console errors.
## Verify before finishing
Confirm the game actually works, don't assume it. If you can run or open it, do so and check: a shot destroys an alien, an alien bomb costs a life, bunkers erode, the wave-clear and game-over transitions both fire, and audio starts only after user input. Fix anything broken before reporting done. If you cannot run it in this environment, say so plainly rather than claiming it passes.
## Output
Deliver the complete `index.html` (in a code block if you're not writing files directly), with a one-line controls comment at the top. Lead with the outcome: one sentence on what's built and how to run it, then the file. No walkthrough of the code.