zprite/main.lua

33 lines
799 B
Lua

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
else
return 0.05, (layer - 27) / 10 + 0.3, 0.05
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
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)
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 + 32, angle, 0.6, 0.6, 24 * 32 / 2, 24 * 32 / 2)
end