Leave trails in grass
Set walked.flatten on the look: grass lies down under feet and stands up again over recover seconds, so anyone moving through leaves a trail behind.
ts
// in src/view.ts
import { foliage } from '@v12-engine/client'
export const grass = foliage({ walked: { flatten: 0.7, recover: 12 } })Done: a unit walking across the meadow leaves a lane of laid grass behind it, which rises again over twelve seconds.
Trails that stay, and grass that springs back
ts
import { foliage } from '@v12-engine/client'
export const look = foliage({
// a bigger unit parts more; `who` is the layer's alone: here only your side's units move any of it
walked: { bend: 1.2, flatten: 0.6, recover: 10, radius: 'size', who: 'friends' },
styles: {
2: { walked: { flatten: 0.9, recover: 0 } }, // wheat stays down until it is grown again
3: { walked: { flatten: 0.3, trail: false } } // reeds stand up as soon as they are left
}
})Lay grass down from code
ts
import type { GameClient } from '@v12-engine/client'
declare const client: GameClient
// a dragon lands: the grass under it lies flat on this screen, and stands again by its `recover`
client.foliage('grass')?.flatten({ kind: 'circle', x: 30, z: 30, radius: 4 }, 1)In the editor
- Open Grass and bushes › Walked on, with Moved by who goes in on.
- Set Lies down, Stands again in, Leaves a trail, Bends, Bent around, Wobbles, Settles in, Stepping in and Moved by.
Reference
walked | Default | What it does |
|---|---|---|
bend | 1 | How far it bends away from who is in it |
radius | 1.6 | Cells around them, or 'size': by each unit's size, at most 3.2 |
wobble | 1 | How far it swings back as it settles |
settle | 1.2 | Seconds the wobble takes to settle |
entry | 2 | How much harder it moves as one steps in |
who | 'all' | 'all', 'friends', 'none', or a function, of the units you see. The layer's alone: a style's who is not read |
flatten | 0 | How far it lies down underfoot, 0 to 1 |
recover | 8 | Seconds to stand again; 0 for never, until it grows back |
trail | yes | Whether a moving unit leaves laid grass behind |
walked: false turns it off. Every unit you see parts the grass, however many there are. Trails are your screen's alone and never reveal a hidden enemy, which isn't sent to you. Bushes drawn as models shake but never lie down. For trampling that the rules see, so the grass stops hiding, use trample: 'crush': see Cut or crush grass.