tiny_code_christmas_2022/tcc2.p8

51 lines
1.5 KiB
Lua

pico-8 cartridge // http://www.pico-8.com
version 39
__lua__
-- tinycodechristmas day 1
-- by rmgr
function _draw()
cls(1)
t=time()
rectfill(0,90,128,128, 11)
rectfill(60, 70, 68, 100, 4)
for i=1,5 do
tri(64,
9 + (i*9),
50 + (-1 * i * 5),
27 + (i*9),
78 + (i * 5),
27 + (i*9),
3)
end
for i=0,128 do
pset(i * 20 % 128, (i + t * 10) % 128, 7)
end
end
function filltri(x1, y1, x2, y2, x3, y3)
invslope1 = (x2-x1)/(y2-y1)
invslope2 = (x3-x1)/(y3-y1)
curpos1 = x1
curpos2 = x1
for s=y1,y2 do
line(curpos1, s, curpos2, s)
curpos1 += invslope1
curpos2 += invslope2
end
end
function tri(x1, y1, x2, y2, x3, y3, c)
line(x1,y1,x2,y2,c)
line(x2,y2,x3,y3,c)
line(x3,y3,x1,y1,c)
filltri(x1,y1,x2,y2,x3,y3)
end
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000