From dcdb3e1bf883fe42093c231e219cf4e60599fbef Mon Sep 17 00:00:00 2001 From: shylie Date: Fri, 29 Aug 2025 14:15:33 -0400 Subject: [PATCH] Update zprite --- main.lua | 22 +++++++++++++--------- zprite | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/main.lua b/main.lua index 9903e65..0b7ad14 100644 --- a/main.lua +++ b/main.lua @@ -7,7 +7,7 @@ local gx = 0 local gy = 0 local angle = 0 local scale = 0.35 -local dist = 4 +local dist = 3 local function layered_noise(x, y, layers, persistence) local freq = 1 @@ -59,7 +59,7 @@ local function calculate_shadow_alpha(x, y) end function colors.water(layer) - if layer % 2 == 0 then + if layer % 2 == 1 then return 0, 0, 0, shadow_alpha end if layer < 14 then @@ -70,14 +70,14 @@ function colors.water(layer) return layer / 32, layer / 16, layer / 8, alpha end function colors.sand(layer) - if layer % 2 == 0 then + if layer % 2 == 1 then return 0, 0, 0, shadow_alpha end layer = layer / 2 return layer / 24 + 0.3, layer / 24 + 0.2, layer / 24 + 0.1, alpha end function colors.dirt(layer) - if layer % 2 == 0 then + if layer % 2 == 1 then return 0, 0, 0, shadow_alpha end layer = layer / 2 @@ -88,7 +88,7 @@ function colors.dirt(layer) end end function colors.stone(layer) - if layer % 2 == 0 then + if layer % 2 == 1 then return 0, 0, 0, shadow_alpha end layer = layer / 2 @@ -96,7 +96,7 @@ function colors.stone(layer) return value / 1.1, value, value * 1.1, alpha end function colors.snow(layer) - if layer % 2 == 0 then + if layer % 2 == 1 then return 0, 0, 0, shadow_alpha end layer = layer / 2 @@ -104,15 +104,19 @@ function colors.snow(layer) return value / 1.1, value, value * 1.1, alpha end +local function scale_map(layer) + return 0 +end + local function offset_map(layer) - if layer % 2 == 0 then + if layer % 2 == 1 then return math.cos(time) / 16, math.sin(time) / 16 + 0.5 else return 0, 0.5 end end -local z = zprite.zchunk.new(tex, 256, 80, dist * 2 + 1) +local z = zprite.zchunk.new(tex, 128, 80, dist * 2 + 1) local function pick_color(height) if height < 0.25 then @@ -133,7 +137,7 @@ end local function generate(x, y) local height = heightmap(x, y) shadow_alpha = calculate_shadow_alpha(x, y) - z:put(x, y, atlas.stone, math.ceil(height * 64) + 16, pick_color(height), offset_map) + z:put(x, y, atlas.stone, 2 * math.ceil(height * 32) + 16, pick_color(height), offset_map, scale_map) end local generated = {} diff --git a/zprite b/zprite index 5a14f0d..7590f0e 160000 --- a/zprite +++ b/zprite @@ -1 +1 @@ -Subproject commit 5a14f0da22d2baf1744277c2c3950e57b76aed96 +Subproject commit 7590f0ea62c01a388d59af2102849d165026f08d