pico8-0hh1/visuals.lua

41 lines
711 B
Lua
Raw Normal View History

2022-07-12 21:47:10 +02:00
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
printh(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]+0b0.1)
rectfill(x, y, x + w, y + h, to_color)
p -= 2
if p < 1 then
del(overlays, self)
end
end
})
end