Update zprite

This commit is contained in:
shylie 2025-08-29 14:15:33 -04:00
parent 1949623e5d
commit dcdb3e1bf8
2 changed files with 14 additions and 10 deletions

View File

@ -7,7 +7,7 @@ local gx = 0
local gy = 0 local gy = 0
local angle = 0 local angle = 0
local scale = 0.35 local scale = 0.35
local dist = 4 local dist = 3
local function layered_noise(x, y, layers, persistence) local function layered_noise(x, y, layers, persistence)
local freq = 1 local freq = 1
@ -59,7 +59,7 @@ local function calculate_shadow_alpha(x, y)
end end
function colors.water(layer) function colors.water(layer)
if layer % 2 == 0 then if layer % 2 == 1 then
return 0, 0, 0, shadow_alpha return 0, 0, 0, shadow_alpha
end end
if layer < 14 then if layer < 14 then
@ -70,14 +70,14 @@ function colors.water(layer)
return layer / 32, layer / 16, layer / 8, alpha return layer / 32, layer / 16, layer / 8, alpha
end end
function colors.sand(layer) function colors.sand(layer)
if layer % 2 == 0 then if layer % 2 == 1 then
return 0, 0, 0, shadow_alpha return 0, 0, 0, shadow_alpha
end end
layer = layer / 2 layer = layer / 2
return layer / 24 + 0.3, layer / 24 + 0.2, layer / 24 + 0.1, alpha return layer / 24 + 0.3, layer / 24 + 0.2, layer / 24 + 0.1, alpha
end end
function colors.dirt(layer) function colors.dirt(layer)
if layer % 2 == 0 then if layer % 2 == 1 then
return 0, 0, 0, shadow_alpha return 0, 0, 0, shadow_alpha
end end
layer = layer / 2 layer = layer / 2
@ -88,7 +88,7 @@ function colors.dirt(layer)
end end
end end
function colors.stone(layer) function colors.stone(layer)
if layer % 2 == 0 then if layer % 2 == 1 then
return 0, 0, 0, shadow_alpha return 0, 0, 0, shadow_alpha
end end
layer = layer / 2 layer = layer / 2
@ -96,7 +96,7 @@ function colors.stone(layer)
return value / 1.1, value, value * 1.1, alpha return value / 1.1, value, value * 1.1, alpha
end end
function colors.snow(layer) function colors.snow(layer)
if layer % 2 == 0 then if layer % 2 == 1 then
return 0, 0, 0, shadow_alpha return 0, 0, 0, shadow_alpha
end end
layer = layer / 2 layer = layer / 2
@ -104,15 +104,19 @@ function colors.snow(layer)
return value / 1.1, value, value * 1.1, alpha return value / 1.1, value, value * 1.1, alpha
end end
local function scale_map(layer)
return 0
end
local function offset_map(layer) 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 return math.cos(time) / 16, math.sin(time) / 16 + 0.5
else else
return 0, 0.5 return 0, 0.5
end end
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) local function pick_color(height)
if height < 0.25 then if height < 0.25 then
@ -133,7 +137,7 @@ end
local function generate(x, y) local function generate(x, y)
local height = heightmap(x, y) local height = heightmap(x, y)
shadow_alpha = calculate_shadow_alpha(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 end
local generated = {} local generated = {}

2
zprite

@ -1 +1 @@
Subproject commit 5a14f0da22d2baf1744277c2c3950e57b76aed96 Subproject commit 7590f0ea62c01a388d59af2102849d165026f08d