forked from hackclub/sprig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlurffy.js
246 lines (246 loc) · 3.87 KB
/
Flurffy.js
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/*
@title: Flurffy
@author: Lucas
*/
const flurffy = "f"
const canoup = "m"
const canodown = "o"
const canot = "t"
const canotd = "d"
const bg = "b"
const canof = "n"
const morte = "h"
setLegend(
[flurffy, bitmap`
................
.......00000....
.....00660220...
....0666022220..
...066660220220.
..0666666022220.
..0000066600000.
.066666060333330
.06666600300000.
..0000066033330.
...06666660000..
....0066660.....
......0000......
................
................
................`],
[canoup, bitmap`
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02`],
[canodown, bitmap`
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402
20D4444444444402`],
[canot, bitmap`
0000000000000000
04444444444444D0
04444444444444D0
04444444444444D0
04444444444444D0
0000000000000000
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02`],
[canotd, bitmap`
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
2044444444444D02
0000000000000000
04444444444444D0
04444444444444D0
04444444444444D0
04444444444444D0
0000000000000000`],
[canof, bitmap`
0000002222000000
0777700000077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777707777077770
0777700000077770
0000002222000000`],
[bg, bitmap`
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222
2222222222222222`], );
setSolids([flurffy, canoup, canodown, canot, canotd]);
let level = 0;
const levels = [
map`
bmbmbm
bmbmbm
bdbdbd
fbbbbn
btbtbt
bmbmbm`,
map`
fbddmm
tbbbmm
mtbbdm
mmtbbm
mmmtbd
mmmbbn`,
map`
mbmmbd
mbmmbn
mbddbt
dbbbbm
fbtbbm
ttmbtm`,
map`
mbmmmm
mbddmm
mbbbbm
dbtbdd
fbmbbn
ttmtbt`,
map`
bbddmbddd
bbbbmbbbb
bbtbmbtbt
bbmbmbmbm
bbmbmbmbm
bbmbmbmbm
bbmbdbmbd
fbmbbbmbn
btmbttmbt`,
map`
ddmddmbddm
fbm.bmbbbb
tbdbbmbtbm
mbbbbmbmbm
mtttbmbmbm
mmmbbmbmbm
mmmmbmbmbm
mmmmbdbmbd
mmmmbbbmbn
mmmmbttmbt`,
map`
ddmddmbdddmmmm
fbmbbmbbbbmmmm
tbdbbmbtbtmmmm
mbbbbmbmbmmmmm
mbttbmbmbmmmmm
mtmmbmbmbmmmmm
mmmmbmbmbmmmmm
mmmmbdbmbdddmm
mmmmbbbmbbbbdm
mmmmbttmbtbbbm
mmmmtmmmtmbbbd
mmmmmmmmmmtbbn
mmmmmmmmmmmtbt
mmmmmmmmmmmmtm`,
];
setMap(levels[level]);
onInput("w", () => {
if (!getFirst(flurffy)) return;
getFirst(flurffy).y -= 1;
});
onInput("s", () => {
if (!getFirst(flurffy)) return;
getFirst(flurffy).y += 1;
});
onInput("a", () => {
if (!getFirst(flurffy)) return;
getFirst(flurffy).x -= 1;
});
onInput("d", () => {
if (!getFirst(flurffy)) return;
getFirst(flurffy).x += 1;
});
var tempototal = 35;
var tempodescendo = setInterval(function() {
tempototal--;
clearText();
addText("" + tempototal, {
y: 1,
color: color`3`
});
if (tempototal <= 0) {
clearTile(getFirst(flurffy).x, getFirst(flurffy).y);
clearInterval(tempodescendo);
clearText()
}
}, 1000);
afterInput(() => {
const atual = tilesWith(flurffy, canof).length;
const f2 = tilesWith(canof).length;
if (atual === f2) {
level = level + 1;
const faseAtual = levels[level];
if (faseAtual !== undefined) {
setMap(faseAtual);
} else {
clearText();
addText("congrats, you win!")
clearInterval(tempodescendo);
}
}
});