# 🐜 Ant vs. The Giant Gardener

A small playable 3D game in Three.js. You are one very determined ant defending your
anthill from a furious giant gardener and his humming string trimmer.

## Run it

Open `index.html` in any modern browser — no build step or server required.
(three.js r160 is loaded from a pinned CDN; `vendor/three.module.js` is a local fallback
if the CDN is unreachable.)

## Controls

| Input | Action |
| --- | --- |
| `W` `A` `S` `D` / arrow keys | scurry across the garden |
| mouse | aim the slingshot (the crosshair turns red over the gardener) |
| left click | fire a pebble |
| `Q` / `E` | swing the camera around the ant |
| `R` / `Enter` | restart |
| `M` | mute |

Move the mouse **up** to crane the camera up the gardener's body — his head is worth
double damage, so it pays to look up.

## How to win

* Pebbles do **24** damage to the body and **50** to the head.
* The gardener telegraphs every swing with a red band on the lawn — that band is exactly
  where the trimmer head will pass. Step out of it, or run in behind the head.
* Get closer than ~18 units and he'll try to stomp you instead: watch for the red circle
  and clear the area.
* He gets faster and swings sooner as his health drops.

## Files

```
index.html            the game (generated, self-contained)
build.mjs             inlines src/*.js into index.html
src/a_util.js         math, procedural canvas textures, geometry helpers, particle pool
src/b_world.js        ground, grass, clover, flowers, pebbles, boulders, anthill,
                      canopy, light shafts, dust motes, material patch (wind/dapple/tint)
src/c_ant.js          the ant rig: body, legs, antennae, slingshot, walk cycle
src/d_gardener.js     the giant: body, 2-bone IK arms, string trimmer, AI state machine,
                      telegraphs, analytic ray/point hit tests
src/e_game.js         renderer, camera boom, input, combat, HUD, audio, main loop
vendor/three.module.js  pinned three.js r160 (offline fallback)
```

Everything is built from Three.js primitives and code-generated `CanvasTexture`s —
no external models, images or fonts.

Rebuild after editing `src/`:

```sh
node build.mjs
```
