feat: terrain

This commit is contained in:
Dan Finch 2026-08-04 12:51:07 +02:00
parent f86b4ada13
commit 81474b6bca
13 changed files with 251 additions and 279 deletions

View file

@ -108,6 +108,16 @@ const floor: Shade = (x, y) => {
return [132 + n, 130 + n, 120 + n, 255]
}
// Outdoor ground. Green, busy, with faux vertical blades and soft patches, kept
// free of strong low-frequency features so it tiles across the terrain without an
// obvious repeating grid.
const grass: Shade = (x, y) => {
const n = noise(x, y) * 18
const blade = noise(x, y * 3) * 8
const patch = noise(Math.floor(x / 8), Math.floor(y / 8)) * 14
return [56 + n * 0.7 + patch * 0.5, 116 + n + blade + patch, 50 + n * 0.5 + patch * 0.4, 255]
}
const wall: Shade = (x, y) => {
const row = Math.floor(y / 16)
const bx = (x + (row % 2) * 16) % 32
@ -161,6 +171,7 @@ const npc: Shade = (x, y) => {
const assets: Array<[string, number, number, Shade]> = [
["floor", 64, 64, floor],
["grass", 64, 64, grass],
["wall", 64, 64, wall],
["crate", 64, 64, crate],
["npc", 48, 64, npc],