Add day 2

This commit is contained in:
rmgr 2022-12-19 19:58:58 +10:30
parent 2a1a001a8f
commit 328100ed52
1 changed files with 50 additions and 0 deletions

50
tcc2.p8 Normal file
View File

@ -0,0 +1,50 @@
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