All MicroEvals
Build a single-file, self-contained HTML5 Canvas game (pure ...
Create MicroEval

Build a single-file, self-contained HTML5 Canvas game (pure ...

Prompt

Build a single-file, self-contained HTML5 Canvas game (pure HTML, CSS, and vanilla JS; zero external assets) that recreates an authentic, charming 2D version of the original Plants vs. Zombies (2009) in Friend-vs-Friend (PvP) Versus Mode. ### 1. Authentic PvZ 1 Visuals & Feel - Classic sunny suburban front lawn: 5 rows x 9 columns with alternating grass-green tiles, a cozy house porch on the far left, and a red painted dividing line between Column 6 and Column 7 (Plants build in Columns 1–6; Zombies place gravestones/spawn in Columns 7–9). - Hand-crafted procedural 2D vector/canvas art for every unit with idle bobbing animations, chewing animations, pea splashes, squash slams, and damage states (e.g., Wall-nuts cracking, Coneheads/Bucketheads losing armor, Target Zombies' targets splintering). - Procedural Web Audio API sound effects (muted toggle included): pea pops, zombie groans, sun/brain collection chimes, lawnmower roar, and victory jingles. ### 2. Local PvP Controls (2 Players on 1 Device) + Solo AI Toggle - **Role Selection Screen:** Pick who plays **Plants** and who plays **Zombies** (plus an optional "vs. AI" toggle for either side so one person can test it solo). - **Controls:** - **Player 1 (Plants):** Uses **WASD** to move a glowing green grid cursor, **1–6** to pick seed packets, **Space** to plant/collect nearby sun (or **Mouse click** if playing vs. AI). - **Player 2 (Zombies):** Uses **Arrow Keys** to move a glowing purple grid cursor, **U/I/O/J/K/L** (or Numpad **1–6**) to pick zombie cards, **Enter** to spawn/collect nearby brains. - Also allow clicking Sun/Brains with the mouse as a fallback, or toggle "Auto-Collect Resources" in the match designer so both players can focus purely on keyboard micro. ### 3. Authentic Versus Mode Roster & Economy - **Plants (Economy: Sun):** - Slot 1 (Locked): **Sunflower** (50 Sun — generates Sun). - Roster: **Peashooter** (100), **Wall-nut** (50), **Potato Mine** (25), **Snow Pea** (150 — slows zombies), **Repeater** (150), **Squash** (75 — instant lane smash), **Jalapeno** (125 — clears a full lane), **Cherry Bomb** (150 — 3x3 blast). - **Zombies (Economy: Brains):** - Slot 1 (Locked): **Zombie Gravestone** (50 Brains — generates Brains and blocks shots). - Roster: **Basic Zombie** (25), **Trash Can Zombie** (50 — high shield HP), **Conehead Zombie** (75), **Pole Vaulting Zombie** (100 — jumps first plant), **Buckethead Zombie** (100), **Football Zombie** (150 — fast + armored), **Flag Zombie** (300 — spawns a mini-wave across lanes). - Include a **Draft / Loadout Phase** where both players alternate picking 5 cards to pair with their Sunflower/Gravestone (plus a "Quick Play" preset button). ### 4. "Design Who Wins" — Match Rules & Win-Condition Designer Before starting the match, include an interactive **Match Designer Panel** where friends can customize how victory is decided: - **Win Mode Selector:** 1. **Classic PvZ Versus:** Plants win by destroying **X Target Zombies** lined up on the far right (default: 3 of 5); Zombies win if **1 Zombie** reaches the house. 2. **Timed Domination:** A countdown timer (e.g., 3 minutes). Whoever has the highest **Domination Score** (weighted by Target Zombies destroyed, total damage dealt, and board control) wins when time expires. 3. **Bounty / Tug-of-War:** First side to push the **Live Advantage Meter** to 100% wins. - **Custom Sliders & Toggles:** - Target Zombies required to win (1 to 5). - Starting Sun & Starting Brains (for handicap balancing between friends of different skill levels). - Lawnmowers: On (1 free save per lane) or Off (instant loss on breach). - **Sudden Death Timer** (default 3 min): disables new Sunflowers/Gravestones, triples recharge speed, and doubles sky resource drops. - **Live "Who's Winning?" HUD Bar:** During the match, display a sleek top tug-of-war meter that calculates real-time **Win Probability (%)** based on economy rate, active board DPS/HP, remaining Target Zombies, and closest zombie to the house. Make sure the game runs at a locked 60fps, handles overlapping hitboxes cleanly, and includes a post-match breakdown screen showing MVP unit, total Sun/Brains spent, and a "Rematch / Swap Sides" button.

A system prompt was added to support web rendering

Drag to resize