51 lines
1.0 KiB
Lua
51 lines
1.0 KiB
Lua
local tex = love.graphics.newImage("mrmo3x.png")
|
|
tex:setFilter("nearest", "nearest")
|
|
|
|
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 - 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, 262144)
|
|
z._height_scale = 8
|
|
|
|
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
|
|
|
|
local angle = 0
|
|
|
|
function love.update(dt)
|
|
angle = math.fmod(angle + dt * 1.2, 2 * math.pi)
|
|
end
|
|
|
|
function love.draw()
|
|
z:draw(
|
|
love.graphics.getWidth() / 2,
|
|
love.graphics.getHeight() / 2 + 64,
|
|
angle,
|
|
0.35,
|
|
0.35,
|
|
24 * 64 / 2,
|
|
24 * 64 / 2
|
|
)
|
|
end
|