Gnome dig, its rules in Hazel

Hazel activities › One-player games · source on GitHub · hazeljs on npm

You are a gnome with a lantern, digging down through the ground for the gems: the arrow keys (or W A S D), a swipe, or the four buttons, held to keep going. The monsters follow your tunnels, and now and then burrow. Dig under a boulder and it wobbles, then falls: it squashes a monster below it (200 points), or you. Your lantern (💡, or Enter or F; from the fourth level, find it first: it glows in the earth near the top) stuns every monster within three cells of you, for three seconds, and is ready again a second later (it glows on you when it is): walk into a stunned one to catch it (100 points). Take every gem for the next level: a party, until you tap, click or press a key. The ghosts never come into the sunlight: let it in on one and it runs, or burns up (150 points). On some levels a love shooter 💘 lies in the earth: with it, the ghosts near you run away, and its love blast (💘 or L, every two seconds) sends hearts straight ahead along the tunnel: every ghost they reach is won over for good (200 points). Deeper in the game, grey bedrock that nothing digs, often over a ghost's pocket, keeps the sun off it. Mind the animals: dig out a mole, a rabbit or a badger and it drops, and a boulder falling on one loses the level. Under the water, boulders and animals fall slowly. From the second level on, some levels have ground water: under it you hold your breath (the bubbles over your head), until you find the level's diving gear 🤿, which lies under the water, just reachable on one breath if you dig straight down to it. Above, trees, bushes, ferns, flowers and mushrooms; below, the trees' roots, the mushrooms' mycelium, an ants' nest, the rabbit's burrow, the mole's run, the badger's sett, worms, grubs and beetles, a new garden of them each level, all made by Hazel too (dig/rules/Scene.hz) from the level's seed. Each step, and the robot that plays it for you, are Hazel (dig/rules/Dig.hz). ⏸ or the space bar pauses.

⏳ Loading the rules…
⭐ 0

This app needs JavaScript, and a page served over http (python3 -m http.server, then localhost).

The vocabulary the module sees (dig/rules/preamble.hz). The listings are text, highlighted, until Edit in Hazel opens each in Hazel's own editor; an edit changes the next step.

loading preamble.hz…
Dig a level's ground by chance; one step of the game (your digging, the boulders, the monsters, the lantern; 0.0.68: the animals, the ground water, your breath and the diving gear; 0.0.69: where the sun shines in, and the animals walking out of it; 0.0.70: the ghosts running from it, or burning; 0.0.71: the love shooter; 0.0.72: bedrock; 0.0.73: the lantern to find; 0.0.74: the love blast, and slower falls under the water); and the robot that plays it: toward the nearest gem it can reach without risk, clear of the monsters while its lantern charges, and to stun a monster guarding the gems; digging round the animals and never letting a boulder fall on one; fetching the diving gear before the gems under the water, and up for air if it must; turning to fire the love blast down a tunnel with a ghost in it
loading Dig.hz…
Scene the scene drawn behind the game, from the level's seed: the trees, bushes, flowers, ferns and mushrooms on top; each tree's roots, grown a segment at a time (wandering, drawn downward, thinning, branching); the mycelium spreading from each mushroom; the ants' nest, the rabbit's burrow, the mole's run and the badger's sett; worms, grubs and beetles. The rules never see it. And (0.0.67) where a creature let go comes to rest, for every cell of the ground: the page drops them with it as you dig
loading Scene.hz…

hazeljs-examples · versions · Apache 2.0 (code), CC BY 4.0 (words, the icon) · by Matthew Hammer · an example for hazeljs