feat: trees
This commit is contained in:
parent
61389f091c
commit
9aa0ec6a3f
10 changed files with 311 additions and 10 deletions
|
|
@ -118,6 +118,30 @@ const grass: Shade = (x, y) => {
|
|||
return [56 + n * 0.7 + patch * 0.5, 116 + n + blade + patch, 50 + n * 0.5 + patch * 0.4, 255]
|
||||
}
|
||||
|
||||
// Tree bark: brown with vertical grain and the odd dark crack.
|
||||
const bark: Shade = (x, y) => {
|
||||
const grain = Math.sin(x * 0.6 + noise(0, y) * 2) * 10
|
||||
const n = noise(x, y) * 14
|
||||
const crack = noise(Math.floor(x / 6), y) < -0.45 ? -24 : 0
|
||||
return [92 + n + grain + crack, 66 + n * 0.8 + grain * 0.6 + crack, 44 + n * 0.6 + crack, 255]
|
||||
}
|
||||
|
||||
// Oak leaves: mid green, blotchy clumps with brighter highlights.
|
||||
const leaf: Shade = (x, y) => {
|
||||
const n = noise(x, y) * 26
|
||||
const clump = noise(Math.floor(x / 5), Math.floor(y / 5)) * 22
|
||||
const hi = noise(x, y) > 0.6 ? 22 : 0
|
||||
return [58 + n * 0.5 + clump * 0.4, 120 + n + clump + hi, 42 + n * 0.4 + clump * 0.3, 255]
|
||||
}
|
||||
|
||||
// Spruce needles: darker, cooler blue-green, finer streaky grain.
|
||||
const needle: Shade = (x, y) => {
|
||||
const n = noise(x, y) * 18
|
||||
const streak = noise(x, y * 2) * 10
|
||||
const clump = noise(Math.floor(x / 6), Math.floor(y / 6)) * 12
|
||||
return [40 + n * 0.4 + clump * 0.3, 84 + n + streak + clump, 58 + n * 0.5 + clump * 0.4, 255]
|
||||
}
|
||||
|
||||
const wall: Shade = (x, y) => {
|
||||
const row = Math.floor(y / 16)
|
||||
const bx = (x + (row % 2) * 16) % 32
|
||||
|
|
@ -172,6 +196,9 @@ const npc: Shade = (x, y) => {
|
|||
const assets: Array<[string, number, number, Shade]> = [
|
||||
["floor", 64, 64, floor],
|
||||
["grass", 64, 64, grass],
|
||||
["bark", 64, 64, bark],
|
||||
["leaf", 64, 64, leaf],
|
||||
["needle", 64, 64, needle],
|
||||
["wall", 64, 64, wall],
|
||||
["crate", 64, 64, crate],
|
||||
["npc", 48, 64, npc],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue