pico8-0hh1/visuals.lua
2022-09-24 15:22:18 +02:00

40 lines
695 B
Lua

local overlays = {}
function get_main_color(tint)
if tint == BLUE then
return 12
elseif tint == YELLOW then
return 8
else
return 1
end
end
function get_shade_color(tint)
if tint == BLUE then
return 13
elseif tint == YELLOW then
return 4
else
return 1
end
end
function spawn_tile_transition(x, y, w, h, from_tint, to_tint)
local p = #patterns
local from_color = get_main_color(from_tint)
local to_color = get_main_color(to_tint)
add(overlays, {
_draw = function(self)
fillp()
rectfill(x, y, x + w, y + h, from_color)
fillp(patterns[p\1]+0b0.1)
rectfill(x, y, x + w, y + h, to_color)
p -= 1
if p < 1 then
del(overlays, self)
end
end
})
end