Spice up the example a little

This commit is contained in:
shylie 2025-07-15 01:33:07 -04:00
parent 50a3a42ab0
commit cab072b4db

View File

@ -1,23 +1,33 @@
local tex = love.graphics.newImage("mrmo3x.png")
tex:setFilter("nearest", "nearest")
local function color(layer)
if layer < 27 then
return layer / 31 / 2.5, layer / 62 / 2.5, 0.1
local function dirt_color(layer)
if layer < 18 then
return layer / 26 / 2.5, layer / 52 / 2.5, 0.1
else
return 0.05, (layer - 27) / 10 + 0.3, 0.05
return 0.05, (layer - 18) / 10 + 0.3, 0.05
end
end
local function mountain_color(layer)
if layer < 29 then
local value = layer / 32 / 2.5
return value, value, value
else
local value = (layer - 29) / 10 + 0.7
return value, value, value
end
end
local BIG_BLOCK = love.graphics.newQuad(24 * 9, 24 * 9, 24, 24, tex)
local z = require("zprite").new(tex, 65536)
z._height_scale = 6
local z = require("zprite").new(tex, 262144)
z._height_scale = 8
for i = 1, 32 do
for j = 1, 32 do
local layers = love.math.simplexNoise(i * 0.06, j * 0.06) * 20 + 12
z:put(i * 24, j * 24, BIG_BLOCK, math.floor(layers) + 1, color)
for i = 1, 64 do
for j = 1, 64 do
local layers = love.math.simplexNoise(i * 0.02, j * 0.02) * 38 + 2
z:put(i * 24, j * 24, BIG_BLOCK, math.floor(layers) + 1, layers < 23 and dirt_color or mountain_color)
end
end
@ -28,5 +38,13 @@ function love.update(dt)
end
function love.draw()
z:draw(love.graphics.getWidth() / 2, love.graphics.getHeight() / 2 + 32, angle, 0.6, 0.6, 24 * 32 / 2, 24 * 32 / 2)
z:draw(
love.graphics.getWidth() / 2,
love.graphics.getHeight() / 2 + 64,
angle,
0.35,
0.35,
24 * 64 / 2,
24 * 64 / 2
)
end