feat: foilage

This commit is contained in:
Dan Finch 2026-08-04 23:03:55 +02:00
parent 67cd54fe33
commit 6fb46573da
9 changed files with 270 additions and 19 deletions

View file

@ -151,6 +151,24 @@ const rock: Shade = (x, y) => {
return [g, g + 3, g + 8, 255]
}
// Flower color atlas (2x2): green stem (top-left), white / red / yellow blooms.
// Geometry samples each region's flat center, so a flower is one solid color.
const flower: Shade = (x, y) => {
const n = noise(x, y) * 8
const left = x < 32
const top = y < 32
if (top && left) {
return [66 + n, 128 + n, 58 + n, 255]
}
if (top) {
return [238 + n, 240 + n, 245 + n, 255]
}
if (left) {
return [202 + n, 52 + n, 58 + n, 255]
}
return [240 + n, 208 + n, 72 + n, 255]
}
const wall: Shade = (x, y) => {
const row = Math.floor(y / 16)
const bx = (x + (row % 2) * 16) % 32
@ -209,6 +227,7 @@ const assets: Array<[string, number, number, Shade]> = [
["leaf", 64, 64, leaf],
["needle", 64, 64, needle],
["rock", 64, 64, rock],
["flower", 64, 64, flower],
["wall", 64, 64, wall],
["crate", 64, 64, crate],
["npc", 48, 64, npc],