pico8-0hh1/visuals.lua

41 lines
782 B
Lua
Raw Normal View History

2022-07-12 21:47:10 +02:00
local overlays = {}
function get_main_color(tint)
2023-10-07 19:12:53 +02:00
if tint == BLUE then
return 12
elseif tint == YELLOW then
return 9
else
return 1
end
2022-07-12 21:47:10 +02:00
end
function get_shade_color(tint)
2023-10-07 19:12:53 +02:00
if tint == BLUE then
return 13
elseif tint == YELLOW then
return 4
else
return 1
end
2022-07-12 21:47:10 +02:00
end
function spawn_tile_transition(x, y, w, h, from_tint, to_tint)
2023-10-07 19:12:53 +02:00
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