Create Space Invaders with marching aliens, shields, UFO bonus, increasing speed, and…
- User
Create Space Invaders with marching aliens, shields, UFO bonus, increasing speed, and pixel-perfect collision.
Assistant
I'll build this as a canvas-based game engine with pixel-perfect sprite collision, plus a React wrapper for UI/controls. Let me start with the sprite definitions.
Now let's create a simple retro sound manager using the Web Audio API.
Now the core game engine — this is the biggest piece, handling state, physics, marching AI, shields, UFO, and pixel-perfect collision.
I'll fix the unused property warning by referencing the canvas or removing the parameter property modifier.
Now let's build the React component that wraps the engine with UI overlays, controls, and touch buttons.
Now let's update App.tsx and the index.html title.
Now let's build the project to verify everything compiles correctly.
Let me verify the UFO sprite rows are consistent length (since I hand-authored the ASCII art) to avoid a runtime error.
I found a sprite width mismatch bug in the UFO sprite (row lengths inconsistent) which would throw a runtime error despite the build succeeding. Let me fix it.
Now let me double check the other sprite definitions (squid, crab, octopus, player) for row-length consistency by reading the file.
All sprite dimensions are now consistent. Let's rebuild to confirm everything compiles correctly.
I've built a complete Space Invaders game. Here's a summary of what was implemented:
Architecture
src/game/sprites.ts— Hand-authored pixel-art bitmaps (boolean grids) for 3 alien types (squid/crab/octopus, each with 2 animation frames), the player ship, and a UFO, plus a procedural bunker-shaped shield generator.src/game/sound.ts— Lightweight Web Audio API retro sound effects (shoot, explosions, marching beat, UFO hit, extra life, game over) with a mute toggle — no external audio files needed.src/game/engine.ts— The core canvas game engine handling state, physics, and rendering.src/components/SpaceInvaders.tsx— React wrapper providing the canvas, keyboard/touch input, HUD, and start/pause/game-over overlays.src/App.tsx— Page shell with title and instructions.
Key features delivered
- Marching aliens: 5×11 grid that steps sideways in unison, drops down and reverses at screen edges, with 2-frame walking animation and a classic descending 4-tone marching beat.
- Shields: 4 destructible bunkers built from a boolean pixel grid; bullets (from either side) carve out a damage radius exactly where they hit, and descending aliens crush shields they pass through.
- UFO bonus: Periodically flies across the top at random intervals awarding random mystery points (50/100/150/300) when destroyed.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.