Tower defense and defensive strategy games. Paths (fixed lanes or open maze-building), placement grids with path-blocking checks, tower types, targeting rules (first, last, strongest, closest), projectiles and splash, upgrades and selling, economy per wave, enemy types with armor and speed, wave scheduling and boss waves, early-call bonuses, game speed controls, touch-friendly placement, and a ...
Download skill (.zip) Files on GitHubTower defense development
Core: place and upgrade towers between and during waves so enemies never reach the exit.
Starter template
A playable starter for the game-scaffolding template is in assets/starter/. A fixed path with build tiles, three towers (single target, splash, slow), first-in-line targeting, upgrades, selling, eight scripted waves with a boss, an early-wave bonus and lives.
python3 <game-scaffolding>/scripts/scaffold.py my-game --title "My Game" --starter <this skill>/assets/starter
Controls: Tap a tower in the bar, then a tile; tap a tower to select or upgrade. Keys: 1-3, arrows + Enter, X sells, N calls the next wave. Esc pauses. All numbers to tune are in src/config.js; the gameplay is in src/scenes/play.js.
Building, path blocking, waves and targeting were tested.
Structure
Play scene: grid map, path (fixed waypoints, or a flow field for open maps), towers, enemies, projectiles, wave director, wallet, build UI. States: build (between waves) / wave / victory / defeat.
Growing the starter (tested modules)
- Grid +
flowField(grid, exit)(pathfinding): every enemy follows one field. Recompute when a tower is placed. - Block check: before placing, test with the tower added:
astar(start → exit)must still succeed, or refuse with a red ghost. - Towers:
{ range, fireRate, damage, type, target: "first" }; find targets with a spatial grid query (game-spatial-partitioning). - Projectiles:
leadAnglefor slow bullets, instant hits for lasers, splash = radius query (projectile-system). - Enemies: hp, armor, speed, resist (combat-system
dealDamage); slow effects withEffects. - wave-spawning with scripted waves,
skipBreak()as “call next wave early” (+ bonus gold). - game-economy Wallet: kill bounty + wave bonus; tower costs and upgrade costs; sell at 70%.
Targeting options
first (furthest along the path: default), last, strongest, closest. “First” uses flow-field distance to the exit.
Balance
- Each tower has a clear job: single-target DPS, splash, slow, anti-armor, anti-air. Counters, not just bigger numbers.
- Wave 1 is beatable with 1–2 towers; total gold at wave N should slightly trail optimal spending (pressure).
- Simulate waves vs a fixed tower layout (game-balance-testing) to find unwinnable or trivial waves.
UX
Show range circles on hover / selection, a placement ghost (green / red), enemy path preview, health bars, game speed ×1/×2/×3, and pause. Touch: tap a tile → radial menu of towers; tap a tower → upgrade / sell. Big tap targets.
Pitfalls
Flow field not updated after placement (enemies walk through towers), allowing fully blocked paths, invisible enemy types, and late waves that are only HP sponges.