Enemies follow a route, you spend coins on towers that stop them. The fun lives in placement choices and a steady rise in pressure.
Tips for tower defense games
Draw the enemy path as a fixed list of waypoints in your prompt. A path the AI has to invent is the most common source of enemies walking through walls.
Ask for a 'Start next wave' button so the player controls pacing; automatic waves that start before the player has placed anything feel unfair.
Give every tower one clear job (single target, splash, slow) and a visible range circle when selected. Three distinct towers beat eight similar ones.
starter
Garden path defense
Make a 2D tower defense game on one screen. A dirt path winds from the left edge to a garden gate on the right using 6 fixed waypoints. Slugs walk the path in waves. The player starts with 100 coins and clicks or taps a grass tile to place a tower: Sprinkler (10 coins, slows), Pea Shooter (25 coins, single target), Bee Hive (40 coins, small area damage). Each slug defeated gives 5 coins. The gate has 10 lives; a slug reaching it costs 1. Survive 10 waves to win. Each wave adds 2 slugs and +10% speed. Show coins, lives and wave at the top, and a Start Wave button. Flat bright colours, simple shapes, no external images. Add a small pop and floating '+5' when a slug is defeated.
Fixed waypoints, exact prices and a defined win wave leave nothing important for the AI to guess.
Follow-up tweaks
Add a fourth tower, Scarecrow, that pushes slugs back a short distance every 3 seconds. Price it at 50 coins.
Let me tap a placed tower to sell it for half its cost and show its range circle.
Make wave 10 a single big boss slug with 20x health and a health bar above it.
starter
Castle wall, one lane
Make a simple one-lane defense game. The castle wall is on the left; cartoon goblins walk in a straight line from the right. Along the top of the wall there are 5 empty tower slots. Click or tap a slot to build an archer (20 gold). Archers shoot the nearest goblin in range. Goblins give 4 gold. If 5 goblins touch the wall, game over. Waves get bigger every 30 seconds; survive 5 minutes to win. Show a timer counting down, gold, and wall health as hearts. Use a storybook palette of soft greens and greys. Keep everything in one HTML file with shapes drawn in code.
A straight lane removes pathfinding entirely, so the first generation almost always works.
Follow-up tweaks
Let me upgrade an archer by tapping it again: level 2 shoots twice as fast for 30 gold.
Add a flying bat enemy that ignores the first two tower slots.
intermediate · tested ✓
Build-your-own maze
Make a grid tower defense where the player builds the maze. The board is 14x9 tiles. Enemies enter at the left middle tile and exit at the right middle tile, always following the shortest path computed with breadth-first search, recalculated whenever a tower is placed. A placement is refused (flash the tile red) if it would fully block the path. Towers: Wall Block (2 coins, blocks only), Bolt (8 coins, single target), Frost (12 coins, slows 40%). Start with 40 coins; enemies give 1 coin. 15 waves; every 5th wave is fast runners. 20 lives. Draw the current path as faint dots so players can see their maze working. Clean geometric look, dark navy board, neon outlines.
Naming the algorithm (BFS) and the rule for blocked paths prevents the classic 'enemies stuck forever' bug.
Follow-up tweaks
Show a preview of the new path while I hover a tile before I place a tower.
Add a 2x speed toggle button in the corner.
intermediate
Upgrade-tree towers
Make a tower defense game with one fixed winding path (8 waypoints) and 10 build spots marked by circles. There is only one base tower, the Turret (15 coins). Tapping a built turret opens a small menu with two upgrade branches: Rapid (fires 3x faster, less damage) or Cannon (slow, area damage). Each branch has 3 levels with rising prices (20, 40, 80). Show the upgrade cost and a one-line effect on each button, greyed out if unaffordable. 20 waves, 15 lives, enemy health grows by 15% each wave. Enemies: basic (red), armored (grey, takes half damage from Rapid), swarm (small, yellow, come in groups of 8). Win screen shows waves survived and towers built.
Branching upgrades with a built-in counter (armored vs Rapid) creates real decisions with only one tower type to code.
Follow-up tweaks
Add a 'sell all' button that refunds 60% so I can rebuild for a new strategy.
Show a small stat panel when a tower is selected: damage, rate, kills.
intermediate
Space station power grid
Make a sci-fi tower defense on one screen. Small drones fly along a fixed route through a space station toward the core. Towers only fire when connected to power: the player places Generators (30 credits) that power every tower within 2 tiles, shown by glowing lines. Laser tower 20 credits, Pulse tower 35 credits (area). Unpowered towers are dimmed and idle. The core has 100 shield; drones deal 10 each. 12 waves; win if the core survives. Drones drop 3 credits. Dark background with cyan and magenta glow, star particles drifting slowly. Add a short screen flash when the core takes a hit.
The power rule gives a second placement puzzle without adding new enemy logic.
Follow-up tweaks
Let generators be destroyed by a new 'saboteur' drone that targets them first.
Add a pause button and the P key to pause.
advanced
Hero plus towers
Make a tower defense where the player also controls one hero. Map: two paths that merge before the base. Towers are placed on marked pads (Archer 20, Mage 35, Barracks 30 that spawns 2 blocking soldiers). The hero moves with WASD/arrow keys or by tapping a destination; it auto-attacks nearby enemies and respawns 8 seconds after being defeated. The hero gains a level every 10 kills (max level 5, +20% damage per level). Ability on Space or an on-screen button: a ground slam that stuns enemies in a radius, 15 second cooldown shown as a circular timer. 20 lives, 15 waves, wave 15 is a boss. Enemy health bars only appear when damaged. Use a cartoon fantasy style with chunky outlines. Keep it under 900 lines of code.
Separating hero, towers and blockers into three short rules keeps an ambitious design buildable.
Follow-up tweaks
Add a second hero I can switch to with Tab or a portrait button.
Make the Barracks soldiers' rally point draggable.
starter
Tap-first mobile defense
Make a portrait-mode tower defense designed for phones. Enemies walk down from the top along an S-shaped path to the bottom. 8 tower spots sit beside the path as large circles (at least 64 px). Tap a spot, then tap one of three tower icons that pop up around it. No hover effects anywhere; everything works by tap. Coins and lives in a bar at the top, big Start Wave button at the bottom. 8 waves to win, 10 lives. Use big friendly shapes and high-contrast colours readable in sunlight. Add a light vibration (navigator.vibrate) when a life is lost, if supported.
Stating portrait layout, tap sizes and 'no hover' up front avoids a desktop-only game.
Follow-up tweaks
Add a fast-forward button that toggles between 1x and 2x speed.
Save the highest wave reached in localStorage and show it on the start screen.
intermediate
Reverse defense: you are the attackers
Make a reverse tower defense game. The computer has already placed 6 towers along a fixed path. The player sends units from the left: Runner (5 coins, fast, low health), Tank (15 coins, slow, high health), Healer (12 coins, heals nearby units). Buttons or keys 1, 2, 3 send units. The player earns 2 coins per second. Each unit that reaches the right edge scores 1 point; 20 points wins the level. The towers win if 3 minutes pass. 3 levels with more towers each. Show tower ranges as faint circles so players can plan. Bright toy-like style.
Flipping the genre is a strong hook, and listing exact unit roles keeps balance testable.
Follow-up tweaks
Add a Shield unit that absorbs the first 5 hits for any unit behind it.
Let towers upgrade themselves every 30 seconds so the pressure rises.
advanced
Elemental combo towers
Make a tower defense game where towers combine. Grid of 12x8 with a fixed snake-like path. Three base towers: Fire, Water, Earth (20 coins each). Dragging one tower onto another of a different element merges them into a combo: Fire+Water = Steam (area slow), Fire+Earth = Lava (damage over time pool), Water+Earth = Vine (roots one enemy for 2 seconds). Enemies have a weakness colour shown as a small dot; matching damage does double. 25 waves, 20 lives. Show a combo recipe card in a side panel. Use bold flat colours per element with simple particle effects for each attack. Mouse drag and touch drag must both work.
Listing every combination explicitly means the AI doesn't have to invent a rule table that may be inconsistent.
Follow-up tweaks
Add a three-element combo: any combo plus a base tower becomes a level 3 tower with a wider range.
Show a 'next wave' preview icon with the enemy weaknesses coming.
30 fill-in master templates with worked examples, 12 multi-step build recipes (what to prompt, what to check after each step, and the fix prompt when it breaks), 40 bug-fix prompts by symptom, 20 art-direction briefs with upload tips, and a game-design + launch checklist. Markdown files, instant download.
One-time $12. Use and adapt the prompts in your own games, commercial ones included. 14-day fix-or-refund if it doesn't work as described. Secure checkout by Stripe.
Free sampler
T01 · Path defense master template (template)
Use it for: classic tower defense with a fixed route and placed towers. The most reliable starting point for the genre.
Variables
Variable
What to write
Example
{{theme}}
Setting in a few words
backyard garden
{{enemy}}
Who walks the path
slugs
{{base}}
What the player protects
the garden gate
{{waypoints}}
Path as a waypoint description
6 waypoints snaking left to right
{{tower_1..3}}
Name, price, role
Pea Shooter, 25, single target
{{start_money}} / {{reward}}
Economy
100 / 5
{{lives}} / {{waves}}
Lose and win conditions
10 / 12
{{palette}}
Visual style
flat bright greens and browns
Master prompt
Make a one-screen 2D tower defense game set in a {{theme}}.
PATH: {{enemy}} walk a fixed path through {{waypoints}} to {{base}}. Draw the path clearly. Enemies move from waypoint to waypoint and never leave the path.
BUILDING: The player clicks or taps an empty build tile beside the path to open a small menu of towers:
- {{tower_1}}
- {{tower_2}}
- {{tower_3}}
Greyed-out buttons when unaffordable. Tapping a built tower shows its range circle and a Sell button (refund 50%).
ECONOMY: Start with {{start_money}} coins. Each enemy defeated gives {{reward}} coins with a floating "+{{reward}}".
WIN/LOSE: {{base}} has {{lives}} lives; each enemy that reaches it costs 1. Survive {{waves}} waves to win.
WAVES: Waves start with a Start Wave button. Use a wave list: each wave adds enemies and +10% enemy health; every 4th wave adds a faster enemy type; the last wave has a boss with a health bar.
FEEDBACK: Enemies flash white when hit, pop into particles when defeated, and the screen shakes briefly when a life is lost.
HUD: coins, lives and wave number at the top; Start Wave and Pause buttons.
STYLE: {{palette}}, simple shapes drawn in code, no external images.
CONSTRAINTS: one HTML file, works with mouse and touch, all movement based on elapsed time, Restart button on the win and lose screens.
Worked example
Make a one-screen 2D tower defense game set in a backyard garden. PATH: slugs walk a fixed path through 6 waypoints snaking from the left edge to the garden gate on the right… Towers: Sprinkler, 10 coins, slows enemies 40% in range; Pea Shooter, 25 coins, single target; Bee Hive, 40 coins, small area damage. Start with 100 coins, 5 per slug. 10 lives, 12 waves. Flat bright greens and browns…
After the first generation, check: enemies stay on the path; towers only fire within the drawn range; selling refunds the right amount; the boss appears on the last wave.
Strong follow-ups
"Add a 2x speed button. Don't change anything else."
"Add upgrades: tap a tower to upgrade to level 2 (+50% damage) for 1.5x its price."
T13 · Classroom quiz engine template (template)
Use it for: any subject quiz you'll reuse with new questions every week.
Variables
Variable
Example
{{subject}}
Year 6 science: forces
{{questions}}
your list, pasted in the format below
{{timer}}
20 seconds, or "no timer"
{{teams}}
2 to 4 teams, or "single player"
{{reward}}
a star burst and a "Great thinking!" message
Master prompt
Make a quiz game for {{subject}}.
DATA: put all questions in an editable array at the very top of the code, clearly labelled QUESTIONS. Each item: question, four answers, index of the correct answer, optional explanation. Use exactly these questions:
{{questions}}
FLOW: shuffle questions and answer order; never repeat within a game. One question at a time with four large buttons (keys 1-4 also work).
TIMER: {{timer}}.
TEAMS: {{teams}}. If teams: show whose turn it is; correct = +10 to that team; turns rotate each question.
FEEDBACK: correct: {{reward}}. Wrong or timeout: chosen answer red, correct answer green, explanation shown for 3 seconds.
END: scoreboard, list of missed questions with correct answers, Play Again.
DESIGN: high contrast, at least 28 px answer text, readable on a projector and a phone.
CONSTRAINTS: one HTML file, works offline, no external fonts or images.
Question format to paste
Q: What force pulls objects toward Earth? | Friction | Gravity* | Magnetism | Air resistance | Gravity pulls everything with mass toward the Earth's centre.
(An asterisk marks the correct answer; the last field is the explanation.)
Check: the asterisk is removed from displayed text; explanations show for wrong answers only; teams rotate correctly after a timeout.
Ship a tower defense in 6 prompts · Step 1 of 6 (recipe-step)
Make a one-screen 2D tower defense game. Cartoon beetles walk a fixed path of 6 waypoints from the left edge to a tree stump on the right. The player clicks or taps a grass tile to place a Leaf Turret for 25 coins; it shoots the nearest beetle within 120 px once per second. Start with 100 coins; each beetle gives 5 coins. The stump has 10 lives; each beetle reaching it costs 1. A Start Wave button sends 8 beetles. Show coins, lives and wave at the top. Shapes drawn in code, flat greens and browns. Restart button on game over.
Check after:
Beetles follow the path exactly and never cut corners through grass.
Turrets can't be placed on the path or on top of each other.
Coins rise on each defeat; lives drop when a beetle reaches the stump.
If it breaks:
*Beetles leave the path:* "Move enemies from waypoint to waypoint in a straight line at constant speed; when within 2 px of a waypoint, snap to it and target the next one. Don't change anything else."
*Towers placed on the path:* "Mark path tiles as unbuildable using a grid; highlight buildable tiles on hover in green and unbuildable in red."
A cozy farm in 8 prompts · Step 1 of 8 (recipe-step)
Make a cozy farming game with a 6x4 grid of soil plots. Tap a plot to cycle: till, plant, water. Seeds: Turnip (2 coins, 2 days), Carrot (5, 3 days), Pumpkin (12, 5 days), chosen from a seed bar. A Sleep button advances the day. Watered plots grow one stage per day (3 visible stages); unwatered plots don't grow. Tap a ripe plant to harvest into a basket. Start with 20 coins. Show coins and day.
Check: crops only grow when watered; watering resets each morning.
Checklist · Core loop (checklist)
[ ] I can describe the game in one sentence: the player does X to achieve Y while avoiding Z.
[ ] The main action is fun on its own for 30 seconds, before any upgrades or levels.
[ ] Every action gives an immediate visible result.
[ ] There's a reason to do the action again (score, progress, story, collection).
[ ] The game has a clear end state for a session (game over, level complete, day end) or a natural stopping point for idle/cozy games.
[ ] I removed features that don't support the core loop.
Fix prompt: "Remove [feature]. It doesn't support the core loop. Don't change anything else."
Checklist · Mobile and touch (checklist)
[ ] The game works with touch only, without hover.
[ ] Touch targets are at least 48-64 px, with space between them.
[ ] Multi-touch works (move and jump at once).
[ ] The page doesn't scroll, zoom or pull-to-refresh during play.
[ ] The game fits portrait and landscape, or clearly asks to rotate.
[ ] HUD stays clear of notches and rounded corners.