-
Notifications
You must be signed in to change notification settings - Fork 1
/
weird_lines.p8
108 lines (91 loc) · 3.46 KB
/
weird_lines.p8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
function _init()
cls()
end
col = 1
function xorpset(x, y, col)
local c = pget(x, y)
if c ~= 0 then
pset(x, y, 0)
else
pset(x, y, col)
end
end
function xorline(x0, y0, x1, y1)
local swap = false
local dx = abs(x1 - x0)
local dy = abs(y1 - y0)
if dx < dy then
x0, y0, x1, y1 = y0, x0, y1, x1
swap = true
end
local len = sqrt(dx * dx + dy * dy)
local lenstep = len / abs(x1 - x0) / 15
local col = 1
local tlen = 0
dy = (y1 - y0) / (x1 - x0)
local ty = y0
local step = (x1 > x0) and 1 or -1
if step == -1 then dy = -dy end
for tx = x0, x1, step do
xorpset(swap and ty or tx, swap and tx or ty, col)
ty = ty + dy
tlen = tlen + lenstep
if tlen > 1 then
tlen = tlen - 1
col = col + 1
end
end
end
function _update60()
if band(x, 7) == 0 then
col = col + 1
if col > 15 then
col = 1
end
for c = 1, 15 do
pal(c, band(col + c, 15))
end
end
end
phase = 0
x = 0
function lineloop()
if phase == 0 then
xorline(x, 127, 127, 127 - x)
elseif phase == 1 then
xorline(127, 127 - x, 127 - x, 0)
elseif phase == 2 then
xorline(127 - x, 0, 0, x)
elseif phase == 3 then
xorline(0, x, x, 127)
end
x = x + 1
if x == 128 then
x = 0
phase = phase + 1
if phase == 4 then
phase = 0
end
end
end
function _draw()
lineloop()
lineloop()
end
__sfx__
010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0118000000070000700c2700c27000070000700c2700c2700007000000000000000000070000700c2700c27000070000700c2700e27000070000700c2700c27000070000700c2700c27000070000700000000000
011800001807300003246750000018173000030000000000182730000300000000001827300003000000000018373000030000000000184730000300000000001857300003000000000018673000030000000000
011800001d3701d3701f3711f3701333013330183771b3771f36722367183571b3571f347000001f3772237726367293671f3572235726347293471f3372233726327293271f3172231726317000000000000000
__music__
00 08090a40