How to make a tower defense game
To make a tower defense game, draw one road from a spawn to a goal, send enemies down it in waves, let towers shoot whatever comes in range, and pay for towers with what the enemies drop. This guide builds Dunewell, scarabs against a desert well, from one sentence in 14.7 minutes.
Press 1, 2 or 3 or tap a tower card, then tap open ground beside the road. Space calls the next wave.
Play in a full tabDownload gameNotices- 14.7 min
- from the sentence to a passing playtest
- 1%
- of a Claude Max week (estimate)
- 32 of 32
- playtest checks passed
- 8 waves
- three towers, three scarabs and 20 water jars
Based on one Cold Chain session on Claude Max 20x (16 Nov 2026) that included other work.
1. Start from a tower defense that already plays
You copy a working tower defense and rewrite its game folder. The kit's tower-defense starter is a three.js game that builds to one HTML file. Its machinery handles the round state, gold, lives, waves, targeting, upgrades and selling, and its bot builds towers and plays eight waves through the same controls a player uses.
Kodeco's Unity tutorial teaches the same loop in two parts: create waves of enemies, make them follow waypoints, and build and upgrade towers. It assumes Unity basics and some C#. Here the loop already exists, so the work is the map, the numbers and the look.
npm run new -- dunewell --from=starters/tower-defense
npm run build -- --game=games/dunewellThe copy lands in games/dunewell/. You rewrite src/game/: config.js for towers, enemies, waves and words, level.js for the map, models.js for what towers and enemies look like, and look.js for sky and light.
2. Write one sentence that names the setting, the enemy and the goal
You tell the agent where the road is, what walks it and what you defend. This is the sentence we gave Claude Code, with the kit's timing command (receipt) running. It moved the game from a mossy valley at dusk to a desert at noon: new map, new colors, new names and a new light.
It leaves out how many waves, how much each tower costs and how fast a scarab walks. The starter's numbers were already balanced by its bot, and Dunewell kept them. Ask for different numbers once the first version plays.
Make a tower defense game where scarab beetles crawl out of a buried desert gate toward the last well, and I build towers along the caravan road to stop them.3. Draw the road as a picture
You draw the board as rows of characters in level.js. S is where enemies spawn on the left edge, # is road, G is the goal on the right edge, . is open ground for towers and x is a boulder. Dunewell's road is 44 cells long and turns six times, so a tower placed at a bend covers two stretches of it.
Wikipedia's tower defense entry calls the strategic choice and positioning of defensive elements an essential strategy of the genre. The map is where that choice lives: a straight road gives every tower the same job, and bends give each tower spot a different value.
4. Pick three towers and three enemies
You give every tower a range, a rate and a damage number. The starter has three behaviours, a fast single-target shot, a slow splash shell and a pulse that slows everything nearby, so Dunewell renames them and keeps the numbers. Each enemy has health, speed, a coin reward and a leak cost.
| Tower | Cost | Job and numbers |
|---|---|---|
| Dart Tower | 55 coins | Fast, single target. Range 7.2, 1.7 shots a second, 13 damage |
| Glass Furnace | 90 coins | Slow, splashes. Range 8.5, 0.55 shots a second, 34 damage over a 2.3 radius |
| Wind Chime | 70 coins | Slows everything nearby. Range 4.4, 0.75 pulses a second, each halving speed for 1.8 seconds |
| Scarab | Health | Speed | Reward and role |
|---|---|---|---|
| Dust Scarab | 22 | 3.6 | 3 coins. Fast and thin: the first thing a Dart Tower should shoot |
| Roller Scarab | 70 | 2.3 | 6 coins. The crowd that fills most waves |
| Stone Scarab | 260 | 1.35 | 22 coins. Armour 6, so weak hits barely scratch it, and it costs 3 water jars if it reaches the well |
Eight waves ramp from 7 rollers in the first to 7 stone scarabs with 18 dust scarabs and 10 rollers in the last, and enemy health grows 40 percent each wave. The player starts with 150 coins and 20 water jars. A tower sells back for 70 percent of what it cost.
5. Change the light, then look at the screenshots

You set the time of day in look.js. The starter is a dusk valley with a low sun. Dunewell moves the sun overhead, turns the sky deep blue over a pale horizon and swaps the fog and bounce light to sand. The ground layers become sand, clay and sandstone, the pine trees become sandstone stacks and acacias, and the gate and the well are rebuilt in warm stone.
The playtest passed 32 of 32 checks, so the rules worked. The screenshots then showed a gate, tower bodies and well columns that rendered nearly black, because the kit's textured brick and concrete read dark under a noon sun. The repair switched those parts to plain sandstone colors. Passing checks said the game ran, and looking said it was wrong.
6. Playtest, repair and play a full round
You run the playtest and open every screenshot. The playtest boots the file, picks a tower with a key, clicks open ground to build, selects, upgrades and sells a tower, changes the speed, calls a wave and lets the bot play all eight waves, then checks the end screens, touch, a sandboxed frame and a file opened with no server. The bot won with 9,980 points in 86.3 seconds of real time, and the rerun after the repair passed 32 of 32 checks again.
The output is dist/index.html, 798 KB. The stamps come from the receipts file; the repair stamp sits 9.6 minutes in, and the last 5 minutes were the capture run and a replay. Read the run record or the full playtest report.
| Moment | UTC, 24 November 2026 | Minutes |
|---|---|---|
| Sentence given to Claude Code | 17:02:51 | 0.0 |
| First build opened | 17:04:26 | 1.6 |
| Repair noted | 17:12:30 | 9.6 |
| Playtest passing, captures read | 17:17:32 | 14.7 |
npm run playtest -- --game=games/dunewell
npm run capture -- --game=games/dunewell7. Play it, change it and see how others did it
You play a full round before you change a number. Open Dunewell above, build a Dart Tower at the first bend and a Wind Chime beside the second, and call each wave early when you are ready. Then change one tower's cost or one scarab's speed in config.js and watch what the bot does with it.
The tower defense starter is part of the $29 a year kit on the pricing page, with nine other genres, and Claude access is billed separately. To play tower defense games made with Claude Code, including a beach defence of our own, open the tower defense collection on Claude Code Games.
Questions
How do I make a tower defense game?
Draw one road from a spawn to a goal, let enemies walk it in waves, let towers shoot whatever is in range, and pay for towers with what the enemies drop. This guide starts from the kit's tower defense starter and ends with Dunewell, a 20 by 12 board with three towers, three scarabs and eight waves.
What do I need to make a tower defense game?
You need a map with a path, enemies that follow it, towers with a range, a fire rate and a damage number, waves, and an economy of coins and lives. The kit's starter has all of them with a bot that plays a full round, so a new game means a new map, new numbers, new models and new words.
How do towers, waves and coins fit together?
Each tower costs coins, and each defeated enemy pays coins back. Calling a wave early pays a bonus for the seconds left on the clock. An enemy that reaches the goal costs lives, and Dunewell starts with 150 coins and 20 water jars. Enemy health grows 40 percent each wave.
How long does it take to make a tower defense game?
Changing the starter into Dunewell took 14.7 minutes of Claude Code, from the sentence to a passing playtest, on 24 November 2026. That included one repair round and about five minutes of screenshots. The requests in that window used an estimated 1% of a Claude Max week.
Can Claude Code make a tower defense game?
Yes, from a starter that already runs. One sentence set the setting, the enemy and the goal. The playtest passed 32 of 32 checks, and the screenshots showed stone that rendered near black, which was repaired and checked again.


