Space Invaders · gemini-3.1-flash-lite
Output generated Cost / run $0.0049 Runtime 14.3s
Prompt for this run
Build a playable Space Invaders game on a canvas: a player cannon that moves and shoots, a descending grid of aliens that advance and fire back, destructible bunkers, score, and lives. Procedural graphics only, no external assets.
TAKE IT TO CODE
A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.
RUN
METRICS
Transcript · 4 messages
Build a playable Space Invaders game on a canvas: a player cannon that moves and shoots, a descending grid of aliens that advance and fire back, destructible bunkers, score, and lives. Procedural graphics only, no external assets.
thinking
**Developing Core Game Mechanics** I'm currently focused on implementing the fundamental elements for Space Invaders. My priority is getting the player cannon to move and fire accurately within the canvas. Simultaneously, I'm laying the groundwork for the alien grid's movement and initial behavior. **Implementing Game State** My focus has shifted to integrating core game state elements. I'm now detailing the variables for score, lives, and the current wave, and beginning to outline the game loop structure using `requestAnimationFrame`. I'm also considering how to represent entities like the player, bullets, and enemies with simple shapes and their respective properties.
index.html (5588 bytes)Successfully wrote 5588 bytes to index.html
The Space Invaders game is now built and contained within the `index.html` file. You can open this file in any modern web browser to play. ### Features Included: - **Player Cannon:** Controlled with Arrow Keys, shooting via Space Bar. - **Enemies:** A grid of aliens that move horizontally and descend when hitting a wall. - **Procedural Graphics:** All elements are drawn using Canvas 2D primitives. - **Game Logic:** Score tracking, lives system, and collision detection. - **Self-contained:** No external libraries or assets. ### How to run: Simply open `index.html` in your web browser.