Asteroids · aion-2.0
Output generated Cost / run $0.0114 Runtime 62.2s
Prompt for this run
Build a playable Asteroids game on a canvas: a thrust-and-rotate vector ship that shoots and wraps around the screen edges, splitting asteroids into smaller pieces, with score and lives. Procedural vector 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 Asteroids game on a canvas: a thrust-and-rotate vector ship that shoots and wraps around the screen edges, splitting asteroids into smaller pieces, with score and lives. Procedural vector graphics only, no external assets.
thinking
I only include one tag. The user wants a single-page self-contained HTML file with an Asteroids game. Let me plan the implementation: 1. **Canvas setup**: Full-screen canvas, or a fixed size like 800x600 centered. 2. **Ship**: Vector-drawn triangle, rotate left/right, thrust forward, wrap around edges, inertia-based movement. 3. **Bullets**: Fire from ship, travel in straight line, wrap around, limited lifetime. 4. **Asteroids**: Start with a few large asteroids, split into medium then small when shot, wrap around edges, move in random directions. 5. **Collision**: Ship vs asteroid = lose life, reset. Bullet vs asteroid = split/destroy, add score. 6. **Score & Lives**: Display on screen. 7. **Controls**: Arrow keys or WASD for thrust/rotate, space to shoot. 8. **Procedural vector graphics**: Draw everything with canvas path operations (lines, no images). Let me write the complete HTML file.
/tmp/ws/index.html (12778 bytes)Successfully wrote 12778 bytes to /tmp/ws/index.html
thinking
Let me start. The user wants a single-file HTML page with a playable Asteroids game. I need to write it to /tmp/ws/index.html. I have done that. The file contains: - Inline CSS for styling (dark background, centered canvas) - A canvas element (900x600) - Inline JavaScript implementing the full Asteroids game: - Ship with rotation (ArrowLeft/Right or A/D), thrust (ArrowUp/W), wrapping - Bullets (Space/Z) that wrap and have limited lifetime - Asteroids with jagged procedural shapes, three sizes (large→medium→small), splitting - Collision detection using circle approximation - Score, lives, level progression - Particle explosions - Game over / restart - Subtle grid background - HUD showing score, level, lives All vector graphics, no external assets, no CDN, no network requests. The game should be fully functional.
The game is written to `/tmp/ws/index.html`. Here's what it includes: **Controls:** - **Arrow Left / A** – rotate left - **Arrow Right / D** – rotate right - **Arrow Up / W** – thrust (with engine flame effect) - **Space / Z** – shoot **Features:** - Thrust-and-rotate vector ship with inertia and speed cap - Bullets with limited range, ship wraps around screen edges - Procedural jagged asteroids in 3 sizes (large → medium → small) - Asteroids split into 2 smaller pieces when shot - Score per asteroid size (20/50/100 points) - Lives (3), level counter, increasing asteroid count per wave - 2-second invincibility after respawn (flashing effect) - Particle explosions on ship death and asteroid hits - Game over screen with final score and restart prompt - Subtle grid background, all vector-drawn — zero external assets or network requests Open `index.html` in any browser to play.