forked from HENRYMARTIN5/Clarity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
580 lines (454 loc) · 55.3 KB
/
index.html
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
<!DOCTYPE html>
<html>
<head>
<title>Clarity</title>
<link rel="manifest" href="clarity.webmanifest">
<script type="text/javascript" src="Clarity.js">
</script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<link href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-dark@4/dark.css" rel="stylesheet">
<script src="https://clarityMultiplayer.n3rdl0rd.repl.co/socket.io/socket.io.js"></script>
<script src="https://pieroxy.net/lzstring/lz-string-1.4.4.js"></script>
<script>window.LZString = LZString144;</script>
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAAD/AAAA/2FhYf9hYWH/YWFh/2FhYf9hYWH/YWF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on">
</head>
<body>
<p class="adress"><br></p>
<center id="contButtons">
<div id="buttoncontainer">
<button class="button-62" role="button" onclick="load()">Load Level from Clipboard</button>
<button class="button-62" role="button" onclick="game.current_map.keys[10].solid = 1;game.current_map.keys[10].img = wallimg;game.load_map(map);">Reload Level</button> <a class="button-62" role="button" href="editr.html">Editr</a> <a class="button-62" role="button" href="workshop.html">Workshop</a> <button class="button-62" role="button" onclick="settings()">Settings</button>
<button class="button-62" role="button" onclick="fullscreen()">Fullscreen</button>
</div>
<canvas id="canvas"></canvas>
<p id="instruct">
Use the left, right and up arrow keys to move. Use the <a href="editr.html" target="">Editr</a> to create and play your own levels!
<br><br>
Clarity just celebrated its first anniversary, so we're pleased to announce the first ever <a href="nostalgia2021/index.html">Nostalgia Trip</a>!
</p>
<center>
<p><span id="debugmenu"></span><br></br><span id="debugmenu2"></span></p>
<!-- HTML !-->
<br></br>
</center>
<script type="text/javascript">
function settings(){
swal.fire({
title: 'Settings',
html: `
<div style="text-align:center;justify-content: center;">
<input class="tgl tgl-skewed" id="cb1" type="checkbox" checked onclick="game.limit_viewport=this.checked;"/>
<label class="tgl-btn" data-tg-off="OFF" data-tg-on="ON" for="cb1"></label>
<span style="font-size: 16px;">Confine viewport to map</span>
</div>
<br>
<div style="text-align:center;justify-content: center;">
<input class="tgl tgl-skewed" id="cb2" type="checkbox" onclick="game.debug=this.checked;" />
<label class="tgl-btn" data-tg-off="OFF" data-tg-on="ON" for="cb2"></label>
<span style="font-size: 16px;">Debug Mode</span>
</div>
<br>
<div style="text-align:center;justify-content: center;">
<input class="tgl tgl-skewed" id="cb3" type="checkbox" checked onclick="game.deathmsgs=this.checked;" />
<label class="tgl-btn" data-tg-off="OFF" data-tg-on="ON" for="cb3"></label>
<span style="font-size: 16px;">Death Messages</span>
</div>
`,
confirmButtonText: 'Save'
})
}
function fullscreen(){
var canvas = document.getElementById("canvas");
if (canvas.requestFullscreen) {
canvas.requestFullscreen();
} else if (canvas.mozRequestFullScreen) { /* Firefox */
canvas.mozRequestFullScreen();
} else if (canvas.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
canvas.webkitRequestFullscreen();
} else if (canvas.msRequestFullscreen) { /* IE/Edge */
canvas.msRequestFullscreen();
}
canvas.width = window.screen.availWidth/2; //document.width is obsolete
canvas.height = window.screen.availHeight/2; //document.height is obsolete
game.set_viewport(canvas.width, canvas.height);
}
// Hook a function to handle when the user exits fullscreen
document.addEventListener("fullscreenchange", function(e) {
if (!document.fullscreenElement) {
// The user has just exited fullscreen
var canvas = document.getElementById("canvas");
canvas.width = 480;
canvas.height = 480;
game.set_viewport(canvas.width, canvas.height);
}
});
function signin(){
Swal.fire({
title: 'Login to Clarity',
html: `<input type="text" id="login" class="swal2-input" placeholder="Username">
<input type="password" id="password" class="swal2-input" placeholder="Password"><br><a href="account.html">No account? Sign up instead!</a>`,
confirmButtonText: 'Login',
focusConfirm: true,
preConfirm: () => {
const login = Swal.getPopup().querySelector('#login').value
const password = Swal.getPopup().querySelector('#password').value
if (!login || !password) {
Swal.showValidationMessage(`Please enter login and password`)
}
return { login: login, password: password }
}
}).then((result) => {
var res = httpGet("https://clarityworkshop.n3rdl0rd.repl.co/login/"+encodeURIComponent(result.value.login)+"/"+encodeURIComponent(result.value.password));
if(res == "ok"){
localStorage.setItem('user', result.value.login);
window.location.reload();
}else {
Swal.fire({
type: 'error',
title: 'Oops...',
text: 'Incorrect login or password!'
})
}
})
}
function signout(){
localStorage.setItem("user", null);
document.getElementById("signinbutton").innerText = "Sign In";
document.getElementById("signinbutton").onclick = signin;
window.location.href=window.location.href;
}
function signedin(){
return localStorage.getItem("user");
}
window.onload = function(){
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('Clarity.sw.js');
}
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const multiplayer = urlParams.get('multiplayer');
if(multiplayer){
game.multiplayer = true;
}
if(signedin() == "null" || signedin() == null){
document.getElementById("buttoncontainer").innerHTML = document.getElementById("buttoncontainer").innerHTML + " <a class=\"button-62\" role=\"button\" href=\"#\" id=\"signinbutton\" onclick=\"signin()\">Sign In</a>";
} else {
document.getElementById("buttoncontainer").innerHTML = document.getElementById("buttoncontainer").innerHTML + " <a class=\"button-62\" role=\"button\" href=\"#\" id=\"signinbutton\" onclick=\"signout()\">Sign Out</a>";
}
if(urlParams.has('id')){
game.id = urlParams.get('id');
document.getElementById("canvas").style.display = "none";
const gameId = urlParams.get('id');
const contButtons = document.getElementById("instruct");
contButtons.innerHTML = contButtons.innerHTML + `<br/><br/><a href="https://discountdevs.github.io/Clarity-Legacy/level.html?id={id}">Back to Workshop</a><br/>`.replace("{id}", gameId);
const lvlCode = httpGet("https://clarityworkshop.n3rdl0rd.repl.co/levelById/"+gameId);
loadFromParam(lvlCode);
document.getElementById("canvas").style.display = "block";
}
}
function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
return xmlHttp.responseText;
}
function loadFromParam(text){
var decompressed = LZString.decompressFromBase64(text);
map.data=JSON.parse(decompressed);game.load_map(map);game.current_map.keys[10].solid = 1;game.current_map.keys[10].colour = '#555';
}
function exitFullscreen(){
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) { /* Firefox */
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) { /* IE/Edge */
document.msExitFullscreen();
}
}
function load(){
navigator.clipboard.readText()
.then(text => {
console.log('Pasted content: ', text);
var decompressed = LZString.decompressFromBase64(text);
map.data=JSON.parse(decompressed);game.load_map(map);game.current_map.keys[10].solid = 1;game.current_map.keys[10].colour = '#555';
})
.catch(err => {
console.error('Failed to read clipboard contents: ', err);
alert('Error: Failed to read level data (Error Code: Amogus)');
});
}
document.onkeyup = function(e) {
if (e.ctrlKey && e.altKey && e.which == 89) {
var cheatCode = prompt("enter dev command:");
if(cheatCode == "gamingchair"){
game.current_map.scripts.death = "";
} else if(cheatCode == "makehaste"){
game.universalSpeed = true;
} else if(cheatCode == "reverthaste"){
game.universalSpeed = false;
} else if(cheatCode == "fartsloudly"){
swal("fart")
}
}
};
window.requestAnimFrame =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
return window.setTimeout(callback, 1000 / 60);
};
var canvas = document.getElementById('canvas'),
ctx = canvas.getContext('2d');
canvas.width = 480;
canvas.height = 480;
/* Customisable map data */
// Begin EDITOR and MAIN similar code
var wallimg = new Image();
wallimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADNJREFUOE9j9PT0/M9AAWAEGcDDw0OWEV++fGEYNWA0DIZLOvD19f3PwcExwHmBLOuhmgCrKEex0FtLIQAAAABJRU5ErkJgggAA';
var elevatorimg = new Image();
elevatorimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAG5JREFUOE9jbPJX/W+jwsdADjhy5xMD4+A2AOREEMDlRbxegGmGhQ02Q3AagK4ZlyFYDYBpfvD6C4OCKA9YLzIb2SVYDVhy/BlYU4ylFANyGCCLw1xEMBopCkSQLcPAAGwBh5xnCAYioQw2OAwAAKSneWF2TERPAAAAAElFTkSuQmCC'
var bouncerimg = new Image();
bouncerimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAL1JREFUWEdjnOSx6D/DAALGQeeAQO0ImobH+qsrUMzHCIEBcwCtLUYPVlhIwENg1AFDJgTQUzF63BLrEbLTwIA5gJDFpIYEySEwYA4g1WJiQ4LoEBh1wGgIDHgITDvRC07YkrzSJLUTnn9+ClafZVGMVR/RuWDAHQBzPrEOIeRzmHlEh8CgcQC6Q3AlCFxxTrUWESwqBswBJGUFPIpJTgPUspjsRDj8HQDzIbFtOnJDZPD2jMj1EaX6Brx3DACes9+BlKvVwAAAAABJRU5ErkJgggAA'
var unlockimg = new Image();
unlockimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAIZJREFUOE9jrK+v/8/JyclADvj+/TsDY0dHx39yNMP0DDIDnh5thftG2rqaKJ/BvQDSHOfEDde0aN9XBmIMARuArBmkEWYQiI0PgCxAMQBmK7prsBkCU0uUC0AugrkGmQ13AcgGXGEAC1iQYpga5PBBSQeEYgGb/CBLSESlHDRFlHuB0uwMAFC6cUuZ0N/DAAAAAElFTkSuQmCC'
var waterimg = new Image();
waterimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAANBJREFUWEftVrEWQDAM1MnGD9n8mtlg95FsJqYYSuQO1fJ07TW9XC9pXNU2cxZw5WVxGN19noAlbnAFYALyVtMwHp5BcdbFsr8qgAZGcTQBOWC51lIIvXijQDIE2Ayu4tOpAjYT1owa/rQC0QmgphWcVj2nFUiGAOsdH39ZgZ9AMAXYMkOJ+HFVDzxGoO673Znw7l/PV0gSdNEJhB5KLW+8pw+gpkRx6kSkSYYGRnE0AfTzYauH9sDdQytNwHI1ux+fgDQi9u2sTFEzrp0wFoEF5tyeUaMzMqsAAAAASUVORK5CYIIA';
var goalimg = new Image();
goalimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAK9JREFUWEdjbI6R/c8wgIBx0DmgpoydpuHR0vUTxXyMEBgwB9DaYvRghYUEPASGnAPUL78Be8p6AQeYntfLQ1LaoTgE6O4AmIXo3qRbCNDdAf9+vwV7VvMG/oKSZiEw4A7AlaTRo4JmITBoHYDusKTiLwNTDsAcMuqA0RAYDYHREBiwEIBZjF4yEtsyorhFNOAOIKkBiEUxxSFAdQfADKR183zw9owoDVJy9Q947xgAE4XdgWlb6HsAAAAASUVORK5CYIIA';
var deathimg = new Image();
deathimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAb9JREFUWEfNlz1OxDAQhWNptQ0H2JZqRQMNRwAajsDeggZuQMctOAI0cARooKOi3SugSF4Rz3OULxpZkVCcFOs4drxv3rz5SYgXTWz+rk332zR7Gy9t1PBmN7fbdPP4nUabt9c/3XT1oXOOhwdoP44NywEgZLL8zCwF4my5GNP6brjfZQRM9AxUByDfCsgm+TRfe/MpfJ/XP00T1AoZ1NzO6RlYDACzvD0fQs/q9iwiQ9zHKLP1MQNLA7B6QTyXtCHL6dIn08ipbTCtFBmYD4CHnBmMlnnq95hyo6AagAerBQKgOKaKnRqQM6O3v5BXQqwO4H2dqqHiGD5qrDa09+tuJYtSPtZ70oLHpBiENkJcDAD68PV3+OQqMaAMqcyY58wXjA5H5D0D1QA8b5MGqNaj9KA9IbLhnDVixIjTCemUEKsDUE/oJSISMLVYSUtOfhl3REy1swNQT/iFf1YVQ6+o3k+7c55QFOgc9Iy9BuiC2QEoEQnSHeJfgEo1ghnUc6WbCasBmBoFXn+gjke+Zj8gA1FzpkfBvwNgImLfX+ps6PtSPhl9GVUHcGMdkXxX6gFLvuX7/MoWQ5YfQqwM4ADxGE162R2WywAAAABJRU5ErkJgggAA'
var saltwaterimg = new Image();
saltwaterimg.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAABOFJREFUWEeNV01PHFcQ7F4MKzNrJUQsx7XhT/kOl/BPcssfMDdI5Bu/COQcTcQe2EUClH1RV1f36wFhvELs7Mz76NddVV2jJxdnTaQJPk3tH36pirSmYndEeQ/DFH8xxZ75td2PdURWN/9iyV8OF7KlKq2J6EZFtmytiUjbYLweX3yJbXwQ1/JALABfF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A5jv024xjQmmonLVWo36SRVTChnpHa4s2j67YT9htOWw1/FkZzYgO7BsrG23bd2qo0kRvM6ahHC3boEN48/xxVnrnc/1nsF219tUprZws3Z67y4oRIaEgBHVhq5n4Hs0lNceQZMb9j7cktY3o3Qy1WZTwbL7HS2ynUJwNiqwkPwsr9h0DEMEaggh6dZblTHupSEpzClvYWtatT10v6KsIakm2boly6trhDJQ+6t2W2b8kNSc6AXdsrtqPFe+fG7d7w3LFl0v9H/sEaiSFD7Yf5QgG4QbzExZUqwz9a03nW5aO11j/c5Wui4D4e+XX+H6IbnZhEI/O53Cb3hwHBjeoL79sMlMZ4O/aRlrikGJN6doWHp6+ReO97gydBO4nDB6Ey5alG/NjKq38qitNTOnLZpOmj72nDxAk/8BxWkkNI6CRLAAAAAASUVORK5CYII=";
var antibounceimg = new Image();
antibounceimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAALFJREFUWEftl0EOhTAIRPUaPWFP3mt8E5O64Ie8QWPFWLcN8DoMqGut9bc8+KxpAEopQ3Vore31DgUmQDoFeo+6MaKAFI8eoATkWIoPA6hK2MJeXH6ATh69kW2N5x1UIA0AgXhmpKmRFUgDoILQzW2e8LvAM6U6phPgtAIkvTr/7wP47iZUb257r8bhJlQTDQNQN5y3MW18WIHhAPTJdfUcFbhagOInwJ8CJNld54//HW99A/sBTxqtNwAAAABJRU5ErkJgggAA';
var spedimg = new Image();
spedimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAALNJREFUWEftl0sKwCAMBeNle4PSHqHgEXsYS5FsBHlN/CRCXXRTIePkGTAcGyUiomt/v/PWGXOtYA6Q7mzAaoUfYFkDnGKUHXS71BlwD4BOzuaGGRgGgNR/Law24BZAevLuBoYD1NRrC4sNuAWYNglR+msgqEXqQcQFW1uzLkDrycW3oOyxOwAUtlpI1RkoDUwD6FVYnQE3AFrlZRbEGWADZgBo9kv/iw1IC6D99o9T69fxAyaci01twl6CAAAAAElFTkSuQmCC'
var airimg = new Image();
airimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADJJREFUOE9jrK+v/8/JyclADvj+/TsDY0dHx39yNMP0jBrAMBqIDKNhAMoPlOcFSrMzAD6dL0uPtm9RAAAAAElFTkSuQmCC'
var tarimg = new Image();
tarimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAQBJREFUOE+NU10LgkAQ9BQCKRQii6AIol4K+gvS//8LvfUQUgQGIQRqzMKe231o+7LHns7Ozs6p1ezQpuMsQJTvO2UZfMc18xvlAlgvd8H1drHA4jAL4klI9bpuKDsBrD89BQASAA6juBthmiyoQxSFupNrPM3gn5kBini+CsqsjdrP87ZqOvFM0Rj8UwXEUgZqNAKKUjgJ4qPOQBaAqQd/KBvIMwGYawMDs7OPlWbAncAAmnCWgkkz8b06bvJ2aE6XU/UWWESTtmTALJIktRyqRxhS3qULGem0PdMaYZC+R8VG4jfAY/+I6OsizYPREGw+vcZHUZLT4H/52nDuE/kLky2YbjxyP0sAAAAASUVORK5CYIIA'
var sandimg = new Image();
sandimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAQ5JREFUOE9jPD4p4r+anBgDCNx69ApMIwOYHEwMXQ0jNgP4+fgZPn76iGHY0zdfGYLNRMHi7/7wgGmsBmDoxCEAMhBsAIjhaKQI94KFEhfYBiGWL3CbsHkP7gJi/AwyFARO3PsGpmFhw7imzve/tAg33Az0QINJ7D93H+xKZAASA3sBJIgccMiG4HI6zCAMA9DDA6YQ2QJkNtgA9GgDuQDdZlyugrsAZhPIBaAwgdHIAYacmGDyjG835P0n5E9sKRUeC7BARHc2sgtgrnj54SdGCoV7gVDIYwsXcEL6vyUJHI2gBIIvU8ESEiwPwLyNEoi4bEFOPCCvgQAs8cGj8dq9Z+CUBkr/yLkNxMYXyAB6KrirkPXw4QAAAABJRU5ErkJgggAA'
var checkpointimg = new Image();
checkpointimg.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAIhJREFUOE9jZM9Z/Z+BAsAIM+Cnsi1JxrDfPQxWDzaAVM0wm0CG4DXAufIWg5xHGMN8+wtYXYfTAJBGGCDZAGTNIENINsC4fhbYcoFfDmCaZANgTocZpOc0jfQwQA6xxIMGI9oAkP9hAFtiIpgS/TfpwA3Y6HcFIzXCDQDJkJofUDITSdkQTTEAv7Fy4Z5FYKEAAAAASUVORK5CYII=";
var lockedimg = new Image();
lockedimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAC5JREFUOE9jtHWP/c9AAWAEGcArIEaWEZ8/vGIYNWA0DEbTAQMD9cKArKwI1QQApWdIEfa7468AAAAASUVORK5CYIIA'
var iceimg = new Image();
iceimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAJJJREFUOE9j9N7w/z8DBYCREgO2HrvMADfAU4GBQYqHeKcEzboMVoxiAEiAGEN2P2JgmL4DhwGEDAFpBgG8BuAyBKaZKAPQDUHWTLQBMEPQNRNtwMZ7DAwqAthjhmAYgDTDADZD8BqArBmXITgNwKYZmyFYDcCnGd0QDAN+/SM+GYPCBMUAUKYgFzAylF2iKDsDAIHrZTO5HBzfAAAAAElFTkSuQmCC';
var walljumpimg = new Image();
walljumpimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAIFJREFUOE9j/LyJ4T8DBYAR2QAeH+JM+rIFoQ6vATCF6AZjNQCbotM3ITaZqjMw4DIEqwtANoA0OxZDDNjfi2kIzBVYDQBpgGmG+RZdDMMAbAFIszAgGAuEwoCgAYTCgKABsIDDFQYgeYKBCPMG0ekAORYGTxjgylo4A5G4vIiqCgAJh3ZR4vXYPAAAAABJRU5ErkJgggAA';
var spawnimg = new Image();
spawnimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAADJJREFUOE9jrK+v/8/JyclADvj+/TsDY0dHx39yNMP0jBrAMBqIDKNhAMoPlOcFSrMzAD6dL0uPtm9RAAAAAElFTkSuQmCC'
var secondaryunlockimg = new Image();
secondaryunlockimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IArs4c6QAACRVJREFUeF7t3LFtXEcARdFlqkw9EFANzByLgHpQ5FJYgyL3YICO1YaqcOaUAtzCCy4Gc5zPPu758y9kAeLTy9vzx8N/BAhcKfAkAFc+d1+awP8CAuAiELhYQAAufvi+OgEBcAcIXCwgABc/fF+dgAC4AwQuFhCAix++r05AANwBAhcLCMDFD99XJyAA7gCBiwUE4OKH76sTEAB3gMDFAgJw8cP31QkIgDtA4GIBAbj44fvqBOYAfP7+hSIBApHAv3/9mpYFYOJzmEArIACtv3UCqYAApPzGCbQCAtD6WyeQCghAym+cQCsgAK2/dQKpgACk/MYJtAIC0PpbJ5AKCEDKb5xAKyAArb91AqmAAKT8xgm0AgLQ+lsnkAoIQMpvnEArIACtv3UCqYAApPzGCbQCAtD6WyeQCghAym+cQCsgAK2/dQKpgACk/MYJtAIC0PpbJ5AKCEDKb5xAKyAArb91AqmAAKT8xgm0AgLQ+lsnkAoIQMpvnEArIACtv3UCqYAApPzGCbQCAtD6WyeQCghAym+cQCsgAK2/dQKpgACk/MYJtAIC0PpbJ5AKCEDKb5xAKyAArb91AqmAAKT8xgm0AgLQ+lsnkAoIQMpvnEArIACtv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QCApDyGyfQCghA62+dQCogACm/cQKtgAC0/tYJpAICkPIbJ9AKCEDrb51AKiAAKb9xAq2AALT+1gmkAgKQ8hsn0AoIQOtvnUAqIAApv3ECrYAAtP7WCaQCeQDSb2+cAIFJ4Onl7flj+gSHCRA4VkAAjn10fnACu4AA7IY+gcCxAgJw7KPzgxPYBQRgN/QJBI4VEIBjH50fnMAuIAC7oU8gcKyAABz76PzgBHYBAdgNfQKBYwUE4NhH5wcnsAsIwG7oEwgcKyAAxz46PziBXUAAdkOfQOBYAQE49tH5wQnsAgKwG/oEAscK/AYC3oRbRZudqgAAAABJRU5ErkJgggAA';
var secondarytileimg = new Image();
secondarytileimg.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAAAXNSR0IArs4c6QAAB4tJREFUeF7t1LFNBEEQRUEuACxEOERADJe/gbAIACRSaOOp1XX+7d+pWb3Hx/Pz98WPAIGTAg8BOHnvDk3gX0AAfAgEDgsIwOHLd3QCAuAbIHBYQAAOX76jExAA3wCBwwICcPjyHZ2AAPgGCBwWEIDDl+/oBATAN0DgsIAAHL58RycgAL4BAocFBODw5Ts6AQHwDRA4LCAAhy/f0QmMA/D69kWRAIFI4Of7fbQsACM+fybQCghA62+dQCogACm/cQKtgAC0/tYJpAICkPIbJ9AKCEDrb51AKiAAKb9xAq2AALT+1gmkAgKQ8hsn0AoIQOtvnUAqIAApv3ECrYAAtP7WCaQCApDyGyfQCghA62+dQCogACm/cQKtgAC0/tYJpAICkPIbJ9AKCEDrb51AKiAAKb9xAq2AALT+1gmkAgKQ8hsn0AoIQOtvnUAqIAApv3ECrYAAtP7WCaQCApDyGyfQCghA62+dQCogACm/cQKtgAC0/tYJpAICkPIbJ9AKCEDrb51AKiAAKb9xAq2AALT+1gmkAgKQ8hsn0AoIQOtvnUAqIAApv3ECrYAAtP7WCaQCApDyGyfQCghA62+dQCogACm/cQKtgAC0/tYJpAICkPIbJ9AKCEDrb51AKiAAKb9xAq2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mFtAkopyAWc3I2GxOoJ5EjUXIDrF7QjmcxodViAM52Nk0FrBDxSJm8AkI50bgCVrpeJxAHkTAGoHFzD8yPNoFQv6vrQUBy05WUO5VIqriyFAhgAlmAz3hE8l6VYReQgCZCQn4B/gmI5jbin41gB6MxbRxpw8QiiASgidoHM5kwR8Q6VhZDbNvp0waqiRTiuy1cbsYW8ffLp8gzMO5DDxC9JgBw0I6JMn48tH2nb/xd0U7XjnLG8hAAAAABJRU5ErkJgggAA';
var mossimg = new Image();
mossimg.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAARRJREFUOE+FU6sOwkAQvAbVkJQm/ABIDBqFRqIxWL4BU0XST0Kj0Bgk/ABJaUKqSMlcmMt0W8qqu33M7s7uRlmW1XEcu0t5dirzZNH4q522qqpclOd5DU84wEDHZDhyk8HMg9zfV1e+ngFQwQPA6XZ0y+nKOxEEjhpcPAqXjlOfiBIAqNBgBcMbgZoIul6AvtL/VtBg8Pth6QCGgJdod9jWJMuWjD/77gL0LWz26xqME1EdEQxi0TfIIw9MBLsHYBAUEOtsJ4M/yfQAnD97/JVRK2iR2LUHtmQG6ZK1xsjy2AZB7KoTJLRgWbYBtHOZmCCQqDPGfJUX5UQ3EiABQEep4+N9EETvALqo65ztKbN8eyc45w/CAMgtolHQZQAAAABJRU5ErkJgggAA';
var coinimg = new Image();
coinimg.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAJ1JREFUOE9jrK+v/8/JyclADvj+/TsDY0dHx39smp8ebUURlrauxmoHVgNAmuOcuFE0LNr3lQGbIRgGYNMMMwmbISgGoGuWFGID633+7hfcNeiG4DQAphmmE2YITgOQbUe3GZ2PbAjcBegGgGwkxhW0MwA58IjyAkgDtnAgOhDRDQDxSY5GbIYgJ0eCCQmmmKKkjGwIsu04MxOl2RkA2O+hSy6NaKkAAAAASUVORK5CYIIA';
window.start_time = performance.now();
//map
var map = {
tile_size: 16,
keys: [
// Void
{id: 0, colour: '#333', solid: 0},
// Air
{id: 1, colour: '#888', solid: 0, img:airimg},
// Platform
{id: 2,colour: '#555',solid: 1,bounce: 0.35, img: wallimg},
// Water
{id: 3,colour: 'rgba(121, 220, 242, 0.4)',friction: {x: 0.9,y: 0.9},gravity: {x: 0,y: 0.1},jump: 1,fore: 1, img:waterimg},
// Elevator
{id: 4,colour: '#b37859', gravity: {x: 0,y: -0.1}, jump: 1, img:elevatorimg},
// Bounce
{id: 5,colour: '#E373FA',solid: 1,bounce: 1.1, img:bouncerimg},
// AntiBounce
{id: 6,colour: '#666',solid: 1,bounce: 0, img:antibounceimg},
// Color Changer Random
{id: 7,colour: '#73C6FA',solid: 0,script: 'change_colour'},
// Goal
{id: 8,colour: '#FADF73',solid: 0,script: 'next_level', img:goalimg},
// Die
{id: 9,colour: '#C93232',solid: 0,script: 'death', img:deathimg},
// Unlockable Wall
{id: 10,colour: '#555',solid: 1, img:lockedimg},
// Unlock Tile
{id: 11,colour: '#0FF',solid: 0,script: 'unlock', img:unlockimg},
// Saltwater
{id: 12, colour: 'rgba(121, 220, 242, 0.4)', friction: {x: 0.9,y: 0.95}, gravity: {x: 0,y: -0.07},jump: 1,fore: 1, img:saltwaterimg},
// Speed Zone
{id: 13, colour: 'rgb(255, 255, 0)', solid:0, fore: 1, boost:1, img:spedimg},
// Tar
{id: 14, colour: '#453a4f', friction: {x:0.3, y: 0.1}, gravity: {x: 0,y: 2}, jump: 1, fore: 1, img:tarimg},
// Quick Sand
{id: 15, colour: '#edb06e', friction: {x:0.6, y: 0.5}, gravity: {x: 0,y: 0.3}, jump: 1, fore: 1, img:sandimg},
// Checkpoint
{id: 16,colour: '#C93232',solid: 0,script: 'checkpoint', img:checkpointimg},
// Ice
{id: 17, colour: '#112233', solid:1, fore: 1, bounce: 0.35, gravity: {x: 0,y: 0.1}, jump: 1, img:iceimg},
// Wall Jump
{id: 18, colour: '#558', solid:1, bounce: 0, jump: 1, img:walljumpimg},
// Foreground Wall Block
{id: 19, colour: "#553", solid:0, fore:1, bounce: 0, img: wallimg},
// Spawn Block
{id: 20, colour: '#551', solid: 0, fore:1, bounce: 0, img: spawnimg},
// Secondary Unlockable Wall
{id: 21, colour: '#535', solid: 1, img:secondarytileimg},
// Secondary Unlock Tile
{id: 22, colour: '#00F', solid: 0, script: 'unlock2', img:secondaryunlockimg},
// Mossy Wall Block
{id: 23, colour: '#355432', solid: 1, img:mossyimg},
// Overhanging Moss
{id: 24, colour: '#355456', solid: 0, img:mossimg},
// Coin block
{id: 25, colour: '#FFF', solid: 0, img:coinimg},
],
// End EDITOR and MAIN similar code
data: [
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
/* Default gravity of the map */
gravity: {
x: 0.0,
y: 0.3
},
/* Velocity limits */
vel_limit: {
x: 12345676789,
y: 15.8
},
/* Movement speed when the key is pressed */
movement_speed: {
jump: 6,
left: 0.3,
right: 0.3
},
/* The coordinates at which the player spawns and the colour of the player */
player: {
x: 1,
y: 1,
colour: '#FF6B00',
},
/* scripts refered to by the "script" variable in the tile keys */
scripts: {
change_colour: 'this.player.colour = "#"+(Math.random()*0xFFFFFF<<0).toString(16);',
/* you could load a new map variable here */
next_level: 'this.current_map.player.x = 1; this.current_map.player.y = 1; this.checkpoint = false; this.load_map(map);this.current_map.keys[10].solid = 1;this.current_map.keys[10].img = lockedimg;this.current_map.keys[21].solid = 1; this.current_map.keys[21].img = secondarytileimg;window. timemillis = performance.now() - window.start_time;window.start_time = performance.now(); exitFullscreen(); Swal.fire({title:"Level Completed!", html: "<i>"+winmsgs[Math.floor(Math.random()*winmsgs.length)] + "</i><br><br><b>Your time: "+(timemillis*0.001).toFixed(2)+" seconds</b><br><br><button class=\'button-62\' role=\'button\' onclick=\'subTime("+(timemillis*0.001).toFixed(2)+")\'>Submit time to leaderboard</button>", });',
death: 'this.load_map(map);this.current_map.keys[10].solid = 1;this.current_map.keys[10].img = lockedimg;this.current_map.keys[21].solid = 1; this.current_map.keys[21].img = secondarytileimg; if(this.deathmsgs){Swal.fire({title:"You Died!", html: "<i><b>"+deathmsgs[Math.floor(Math.random()*deathmsgs.length)] + "</b></i>", });}',
unlock: 'this.current_map.keys[10].solid = 0;this.current_map.keys[10].img = airimg;',
unlock2: 'this.current_map.keys[21].solid = 0;this.current_map.keys[21].img = airimg;',
checkpoint:
'this.current_map.player.x = Math.round(this.player.loc.x/16);this.current_map.player.y = Math.round(this.player.loc.y/16); console.log("CHECKPOINT"); this.checkpoint = true;',
}
};
function subTime(time){
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
if(!urlParams.has('id')){
swal.fire("Error!", "Speedrun can not be submitted on the default level or a level loaded from the clipboard!", "error")
return false;
}
if(signedin() == "null"){
signin()
return false;
}
if (signedin()){
swal.close()
httpGet("https://clarityWorkshop.n3rdl0rd.repl.co/speedrun/"+urlParams.get("id")+"/"+time.toString()+"/"+signedin())
} else {
signin()
return false;
}
}
/* Setup of the engine */
var game = new Clarity();
game.set_viewport(canvas.width, canvas.height);
game.load_map(map);
/* Limit the viewport to the confines of the map */
game.limit_viewport = true;
var Loop = function() {
ctx.fillStyle = '#333';
ctx.fillRect(0, 0, canvas.width, canvas.height);
game.update();
game.draw(ctx);
// window.requestAnimFrame(Loop);
};
var deathmsgs = ["Whoops.","That wasn't supposed to happen…","My bad.","Get one shotted lol","Git gud","Please try again later.","Skill issue?","You look dumb now, don't you?","Dev needs to fix this","GG ez","That's all?","Time to repeat the process.","Here we go again…","Try not to do that again next time.","Clearly, something happened that led to your death.","Are you okay?","You'll recover. Someday.","This is the part where you yell at your screen.",":clown:","Why did you do that?","Bro…","Seriously?","Well…","Yikes.","This is embarrassing.","Try not to ragequit.","Lol","Hahaha","That didn't work out.","Learn from your mistakes.","Mission failed. We'll get 'em next time.", "'Tis but a flesh wound!","Spartans never die. They just go M.I.A.","Ouch.","That's… bad…","Task failed successfully.","K.O.!","Wipeout!","FATALITY","Oof","Why?","Stop.Doing.That.","-15respect","That must've hurt.","What an ePiC fAiL","Return by death.","Were you expecting something?","What did you expect?","You died.","WASTED","OBLITERATED","BRUTALITY","Objective failed.","That happened.","Things aren't looking so bright.","Not everything is sunshine and rainbows,by the way.","Eliminated.","Respawning…","AAAAHHHHHHHHH","Welp.","There is an unnecessary amount of death lines in this game.","Wanna hear a joke? Your life!","Tip: Don't die.","Have you tried NOT dying?",":god me","/kill all … Oh,it worked.","The end.","FIN","Hello,player.","Good thing that I placed a bed for you to respawn at.","Take #2!","Alt+F4 to close your game.Just a useful reminder.","Time to unplug the router…","Please don't smash your monitor.","Your safety isn't guaranteed ¯_(ツ)_/¯","Not everything goes well in this game.","Perhaps I should nerf that…","Wrong button.","Misclick?","I know.It's not your computer.It's not lag.Or is it?","Pfft.","You died that easily?","I expected a little more,but okay.","Aaaaand that's a wrap.","That's all,folks!","Unlock God Mode for $49.99.","Vibe check.","Oops.","That was a mistake.","I guess I forgot to remove that.","Good game.","Simon says… rejoin!","Got you!","I'm honestly running out of ideas.","What do{I put here again?","Sample text here","Lorem ipsum dolor sit amet,consectetur adipiscing elit.Aliquam est nisl,posuere vitae lacus a,mattis ornare dui.Nunc consequat.","Looking for something?","You're back!","Sorry.","You died.","You'd still be alive if it weren't for[INSERT TEXT HERE]","FYI, you didn't have to die.","bad","noob","Next time.","Looks like somebody isn't getting their Winner Winner Chicken Dinner.","Alright, what happened now?","Get up on your feet.","*Sigh*… do you want me to turn on Baby Mode?"," 'Tis but a wound.","From zero to hero and then back to zero.","How… unfortunate.","I am inevitable.","Cut!"]
var winmsgs = ["gg man", "Good job!", "Good job!", "speedrun wr go brr", "@N3rdL0rd on Replit.com!", "Spaceship Shutdown", "MatPat please cover our lore please please please", "no", "yes", "es6 standard typing plaese", "haha speling goo berrr", "when ze impustor is sus", "Also try Minecraft!", "amogus", "insert win message here", "nerdy!", "Roll a d20 for stamina!", "WOOT WOOT", "POOTIS BIRB", "beacuase", "liam is a level creator", "...", "1234567890qwertyuiop", "wasdijkl", "idk", "pootis.birb.com", "your mom!", "sus", "Roll a d6 for the speedrun WR!", "Roll a d20 for agility!", "Roll a d20 for fancyness!", "Hyperbole!", "I don't know what I'm doing with my life!", "Why am I still here?", "Hi.", "You know, I'm kinda bored.", "Why are we all still here?", "Really?", "Bro, you're wasting your life.", "Please please please please", "H̷̟̮̻͕̑̾͂͋̓͠E̶͇̫̪̗̿L̸̦͕̻̻̈́͐͋̀P̴̛͕͊͋͊͗̏̾͠ ̵̧̛̣͖͎͛̊̎M̵̛̖̈̏̃̀͛͠Ę̷̫̪̣̿̒̄͂̏̆", "Stop.", "Possibility!", "Flux Capacitor!", "1.21 gigawatts!", "Stop wasting your life.", "Touch grass, nerd.", "If you're gonna play games all day, at least play something other than Clarity.", "lol", "Stealth Mission? Ah... Screw this!", "surf_utopia_v3", "2fort", "Breath of the Wild!", "Supercalifragilisticexpialidocious!", "This game has a crap ton of win messages!", "Wanna hear a joke? Your life!", "URMOM", "ALL HAIL N3RDL0RD!", "Don't smash the monitor!", "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", "qwertyuiopasdfghjklzxcvbnm1234567890!@#$%^&*()-_=+[{]}", ".", "Vim Keybinds: Coming Soon!", "OmG I gOt A wOrLd ReCoRd!!1!", "To Hell and Back!", "why", "There's no soundtrack! Yet...", "Fun Fact: I'm bored.", "I'm writing this message while at school!", "I am bored out of my mind!!!", "Red sus ඞ", "FORTNITE BATTLE PASS", "Make your time 2x faster for as little as $9999999.99!", "I should probably fix how fast that was...", "Jeez!", "Mathmatical!", "Radical!", "Totally Tubular, dude!","Whoa... RAD!", "Where we're going, we don't need roads.", "Spacetime!", "4D Mode Coming Soon!", "No win message for you!", "Was that a world record?!?!?!?", "OOB skips", "hax", "WTF?!?!?"];
/* Start */
// Loop();
var interval = setInterval(Loop, 16.7);
</script>
</body>
</html>