-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmob.html
558 lines (557 loc) · 32.5 KB
/
mob.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
<!DOCTYPE html>
<html>
<head>
<title>Back to Life</title>
<link rel="shortcut icon" id="favicon" />
<meta name="viewport" content="user-scalable=no">
<style>* {
-webkit-user-select: none; /* Chrome all / Safari all */
-moz-user-select: none; /* Firefox all */
-ms-user-select: none; /* IE 10+ */
-o-user-select: none; /* Opera */
user-select: none; /* Likely future */
}
body {
background: #0c161d;
color: #88776a;
font-family: courier new;
font-size: 24px;
overflow:hidden;
scrollbar-width: none;
cursor: crosshair;
}
body::-webkit-scrollbar {
display: none;
}
span {
display: inline-block;
}
.drain {
background-image: linear-gradient(90deg, rgb(22, 22, 22) 45%, rgba(154, 141, 141, 0.3) 65%);
background-size: 19px 50px;
border-top-left-radius: 90px;
border-top-right-radius: 90px;
height: 20px;
width: 100px;
z-index: 15;
top: 350px;;
box-shadow: inset rgb(15, 15, 15) 0px 0px 2px 3px;
}
.inside .drain {
display: none;
}
.door {
background-image: linear-gradient(#000 75%, #222);
border-top-left-radius: 90px;
border-top-right-radius: 90px;
height: 158px;
width: 100px;
z-index: 15;
top: 97px;
box-shadow: #1f1f1f 0px 0px 3px 4px;
perspective: 350px;
overflow: hidden;
display: none;
}
.door .green {
background-color: #051f01fa;
box-shadow: inset #001306 0px 0px 3px 4px;
background-image: linear-gradient(90deg, transparent 97%, #193115fa 97%);
}
.door .red {
background-color: #400b0bfa;
box-shadow: inset #250307 0px 0px 3px 4px;
background-image: linear-gradient(90deg, transparent 97%, #562121fa 97%);
}
.door .black {
background-color: #400b0bfa;
box-shadow: inset #250307 0px 0px 3px 4px;
background-image: linear-gradient(90deg, transparent 97%, #562121fa 97%);
}
.inside .door {
background-image: linear-gradient(#AD9E7B22 80%, #11111133 20%);
background-color: #ffffff44
}
.door div {
transition: transform 0.5s;
transform-style: preserve-3d;
transform-origin: right center;
width: 100%;
height: 100%;
z-index: 16;
border-top-left-radius: 90px;
border-top-right-radius: 90px;
background-size: 21px 50px;
}
#status {
background-color: #fff;
color: #000;
font-weight: bold;
height: 27px;
}
#sentence {
width: 960px;
height: 33px;
text-align: center;
line-height: 33px;
color: white;
}
#controls {
width: 960px;
height: 138px;
}
#controls span:hover {
color: #ffe9be;
}
#controls div {
float: left;
}
#arrows {
width: 42px;
}
#arrows span {
font-size: 50px;
height: 67px;
width: 40px;
line-height: 78px;
text-align: center;
background-color: #2d2022;
margin: 1px;
}
#items {
width: 308px;
height: 136px;
background-color: #2d2022;;
margin: 1px;
overflow: hidden;
position: relative;
}
#itemlist {
position: absolute;
left: 0px;
padding: 2px 4px 2px 4px;
}
#itemlist span {
width: 300px;
}
#commands {
width: 608px;
font-size: 26px;
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
}
#commands span {
background-color: #2d2022;
width: 150px;
margin: 1px;
height: 44px;
text-align: center;
line-height: 44px;
}
#wrap {
background-color: #000;
margin-top: auto;
margin-bottom: auto;
width: 960px;
height: 627px;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
opacity: 0;
overflow: hidden;
}
#screen {
position: relative;
height: 430px;
overflow: hidden;
background-color: #333333;
}
#screen * {
position: absolute;
}
#wall {
top: 50px;
width: 960px;
height: 209px;
z-index: 5;
background-color: #ffe4c42e;
}
.bricks {
/*background-color: transparent;*/
background-image:
linear-gradient(335deg, rgba(80, 80, 80, 0.2) 23px, transparent 23px),
linear-gradient(155deg, rgba(88, 88, 88, 0.3) 23px, transparent 23px),
linear-gradient(335deg, rgba(80, 80, 80, 0.2) 23px, transparent 23px),
linear-gradient(155deg, rgba(88, 88, 88, 0.3) 23px, transparent 23px);
background-size: 58px 58px;
background-position: 0px 2px, 4px 35px, 29px 31px, 34px 6px;
}
.outside #wall {
top: -8px;
height: 263px;
}
#wall.left {
left: 100px;
}
#wall.leftright {
left: 100px;
width: 758px;
}
#wall.right {
width: 860px;
}
@keyframes movewater {
0% {
left: -110px;
}
100% {
left: 0px;
}
}
#curb {
width: 960px;
height: 30px;
background-color: rgba(68, 68, 68, 0.2);
bottom: 60px;
z-index: 1;
box-shadow: #111 0px 10px 25px 0px;
}
.inside #curb{
display: none;
}
#water {
background:
linear-gradient(#222222 55%, rgba(255,255,255,0) 0) 0 0px,
radial-gradient(circle closest-side, #222222 63%, rgba(255,255,255,0) 0) 0 0,
radial-gradient(circle closest-side, #222222 60%, rgba(255,255,255,0) 0) 55px 0 rgba(255,255,255,0);
background-size:110px 90px;
background-repeat:repeat-x;
width: 1070px;
height: 90px;
bottom: 0px;
z-index: 0;
animation-duration: 10s;
animation-name: movewater;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
#road {
width: 1070px;
height: 90px;
bottom: 0px;
z-index: 0;
}
.inside #road {
display: none;
}
#wall {
top: 0px;
height: 259px;
width: 960px;
z-index: 0;
}
.left.path {
left: 0px;
width: 0;
height: 0;
top: 130px;
border-top: 125px solid rgba(0, 0, 0, 0.3);
border-right: 100px solid transparent;
}
.right.path {
left: 860px;
width: 0;
height: 0;
top: 130px;
border-top: 125px solid rgba(0, 0, 0, 0.3);
border-left: 100px solid transparent;
}
.path {
width: 100px;
height: 255px;
top: 0px;
z-index: 10;
}
#sky {
background: linear-gradient(
hsl(0, 70%, 5%) 0%,
hsl(0, 70%, 20%) 50%);
height: 130px;
width: 960px;
z-index: 0;
}
#mist {
box-shadow: rgb(107, 160, 119) 0px 58px 33px -27px inset;
height: 70px;
width: 960px;
z-index: 100;
}
#buildings {
height: 50px;
width: 960px;
top: 80px;
background-color: black;
}
#sign {
left: 120px;
top: 59px;
z-index: 6;
color: #bbb;
background-color: #265f28;
border: 1px solid #bbb;
border-radius: 4px;
padding: 0 8px 0 8px;
font-family: Verdana, sans-serif;
font-size: 15px;
/*box-shadow: #1f1f1f 0px 0px 3px 4px;*/
}
#sign.right {
left: 730px;
}
#sign.leftright {
left: 430px;
}
#sides {
top: 0px;
left: -50px;
height: 430px;
width: 1060px;
border-top-right-radius: 60px;
border-top-left-radius: 60px;
z-index: 720;
pointer-events: none;
box-shadow: #000 -100px 0 0px 40px inset, #000 100px 0 0px 40px inset;
}
.outside #sides {
display: none;
}
.bubble {
font-size: smaller;
padding: 15px;
color: #fff;
background: #AD9E7B;
border-radius: 10px;
bottom: 177px;
}
.speech:before {
content: "";
display: block;
position: absolute;
top: -27px;
left: 9px;
width: 0;
border-width: 15px 15px 0;
border-style: solid;
border-color: #AD9E7B transparent;
}
.sprite {
/* Hack for Chrome, so that doors are not drawn on top of other sprites. */
transform: rotateY(0deg);
}
.actor:after, .ghost:after {
content: "";
position: absolute;
bottom: -5px;
left: 0px;
width: 50px;
height: 10px;
background: #000;
border-radius: 50%;
opacity: 0.5;
}
#doll:after {
width: 20px;
height: 6px;
}
#blanket {
background-color: #520116;
border: 3px solid black;
}
#phone {
background-color: silver;
border: 2px solid black;
}
#book {
background-color: #60447b;
border: 2px solid black;
}
.b1 {
background-color: rgba(55, 0, 0, 0.3);
}
.b2 {
background-color: rgba(25,16,0,0.5);
}
.b3 {
background-color: rgba(0,0,0,0.8);
}
.b4 {
background-color: rgba(0,19,35,0.3);
}
#crossing {
bottom: 15px;
left: 260px;
border-bottom: 28px solid rgba(255,255,255,0.1);
border-left: 25px solid transparent;
border-right: 25px solid transparent;
height: 0;
width: 385px;
}
.ghost {
opacity: 0.3;
transform: rotateY(0deg);
display: block;
}
.green, .green.key::before, .green.key::after {
background-color: #146b07
}
.black, .black.key::before, .black.key::after {
background-color: black;
}
.key::before {
content: '';
display: inline-block;
position: absolute;
width: 8px;
height: 8px;
top: -2px;
left: -4px;
border-radius: 4px;
}
.key::after {
content: '';
display: inline-block;
position: absolute;
width: 6px;
height: 5px;
top: 0px;
left: 17px;
}
#light_beam {
content: "";
position: absolute;
transition: all 0.4s;
transform: translateX(-50%) perspective(400px) rotateX(45deg);
transform-origin: top center;
background: linear-gradient(0deg, transparent, rgba(255, 255, 255, 0.2));
}
#msg {
z-index: 1500;
height: 33px;
font-size: 50px;
margin-top: -25px;
text-align: center;
position: absolute;
width: 100%;
top: 50%;
animation: blinker 1.5s linear infinite;
color: white;
}
@keyframes blinker {
50% {
opacity: 0;
}
}
#time_machine {
background-color: #363f5f;
border: 2px solid black;
border-radius: 100px / 50px;
box-shadow: inset #001306 0px -1px 4px 2px, #7a7f5e 0px -3px 7px -1px;
}
#reaper {
transform: rotate(90deg) rotateY(0deg);
}
#reaper::after {
left: 28px;
width: 22px;
height: 148px;
}
#backpack {
border: 2px solid black;
background-color: rgb(20, 30, 20);
background-image: linear-gradient(0deg, transparent 60%, #2a332afa 60%);
}</style>
</head>
<body>
<div id="msg">Click to start</div>
<div id="wrap">
<div id="status">
<span style="width:90px;"> Score:</span>
<span style="width:210px;" id="score">0 of 230</span>
<span style="width:300px;text-align:center;">Back to Life</span>
<span style="width:300px;text-align:right;" id="time"> </span>
</div>
<div id="screen" class="inside">
<div id="mist"></div>
<!--div id="buildings"></div-->
<div class="drain" style="left:85px;"></div>
<div class="drain" style="left:430px;"></div>
<div class="drain" style="left:775px;"></div>
<div class="door" style="left:243px;"><div></div></div>
<div class="door" style="left:620px;"><div></div></div>
<div id="sides" class="left right"></div>
<div class="left path"></div>
<div class="right path"></div>
<div id="sign"></div>
<div id="wall"></div>
<div id="curb"></div>
<div id="road"></div>
<div id="crossing"></div>
</div>
<div id="sentence">Walk to</div>
<div id="controls">
<div id="commands">
<span>Open</span><span>Pick up</span><span>Use</span><span>Put on</span>
<span>Close</span><span>Look at</span><span>Push</span><span>Take off</span>
<span>Give</span><span>Talk to</span><span>Pull</span><span>Eat</span>
</div>
<div id="arrows">
<span id="up">⇧</span>
<span id="down">⇩</span>
</div>
<div id="items">
<div id="itemlist">
</div>
</div>
</div>
</div>
<script>let a={m:{}};a.m.da=function(b,c,d,e,h){e/=2;b.beginPath();b.arc(c+e,d+e,e,0,h*Math.PI);b.closePath();b.fill();b.stroke()};a.m.ba=function(b,c){var d=document.createElement("canvas");d.width=b;d.height=c||b;return d.getContext("2d")};
a.m.Ma=function(b,c,d,e,h,l,k,q,m){var g=a.m.ba(b,c+b/10),n=b/5;g.lineWidth=3;g.lineJoin="round";m&&(g.strokeStyle=m);k&&(g.fillStyle=k,a.m.da(g,b/2-n/2,0,n,2));m=b-b/5;n-=n/5;g.fillStyle=k;a.m.da(g,(b-m)/2,n,m,2);g.fillStyle=h;a.m.da(g,(b-m)/2,n,m,k?1:2);n+=m;var u=n+b/10,r=b/2.75;q&&(g.fillStyle=q,g.beginPath(),0!=d&&g.rect(b/2,u,-r,m),1!=d&&g.rect(b/2,u,r,m),g.closePath(),g.fill(),g.stroke());h=n+b+b/1.5;k=b/6;g.fillStyle=l;g.beginPath();g.moveTo(b/2,n);g.lineTo(b/2-k,n);1!=d&&g.lineTo(3,h);g.lineTo(b/
2-k,h);g.lineTo(b/2+k,h);0!=d&&g.lineTo(b-3,h);g.lineTo(b/2+k,n);g.lineTo(b/2,n);g.closePath();g.fill();g.stroke();q&&2==d&&(g.fillStyle=q,g.beginPath(),g.rect(b/2-r,u,2*r,m),g.closePath(),g.fill(),g.stroke());c-=h;l=[1,1,.5];d=l[e];e=l[(e+1)%3];g.beginPath();g.moveTo(b/2-k,h);g.lineTo(b/2-k,h+c*d);g.moveTo(b/2+k,h);g.lineTo(b/2+k,h+c*e);g.closePath();g.stroke();return g.canvas};a.xa={Ka:function(b,c,d,e){let h=c,l=d.replace(" ","_");switch(b){case "Pull":switch(d){case "reaper":!a.f[11]||2>a.f[11]?a.a.moveTo(a.j.x-50,550,function(){a.j.L=!1;a.j.moveTo(a.j.x-70,a.j.z,function(){a.j.L=!0});a.a.moveTo(a.j.x-120,550);a.f[11]=a.f[11]?2:1}):f(a.a,"I think I'll let him be now.",220)}break;case "Push":switch(d){case "reaper":f(a.a,"Maybe I should try pulling.",220)}break;case "Walk to":switch(d){case "door":a.f[8]?(a.a.moveTo(a.g.offsetLeft+a.g.offsetWidth/2,a.a.z,function(){a.v||
(a.g.children[0].style.transform="rotateY(-120deg)")}),a.a.moveTo(a.g.offsetLeft+a.g.offsetWidth/2,a.g.offsetTop)):f(a.a,"The door is closed.",220);break;case "left path":case "right path":a.a.stop();a.a.moveTo(e.target.offsetLeft+e.target.offsetWidth/2,a.a.z);a.a.moveTo(e.target.offsetLeft+e.target.offsetWidth/2,e.target.offsetTop);break;case "road":f(a.a,"I should use the pedestrian crossing.",220);break;case "crossing":a.b.h=!1;a.a.stop();a.a.moveTo(e.pageX/a.X,2*(e.pageY/a.Y-27),function(){a.a.moveTo(a.a.x,
1E3)});break;default:a.a.stop(!0),530<2*(e.pageY/a.Y-27)?a.a.moveTo(e.pageX/a.X,2*(e.pageY/a.Y-27)):a.a.moveTo(e.pageX/a.X,600)}break;case "Look at":switch(d){case "left path":case "right path":f(a.a,"The path makes a 90 degree turn around the corner.",250);break;case "time machine":a.b.T("time machine")?f(a.a,"It has a solar panel on it.",250):f(a.a,"Why did the older Reaper have a time machine?",250);break;case "door":a.f[8]?f(a.a,"The door is open.",250):f(a.a,"The door is closed.",250);break;
case "ghost":f(a.a,"Why do I feel like I'm the reason they're ghosts?",250,function(){f(a.a,"Why is everyone dead?",200)});break;case "mist":f(a.a,"The mist is glowing green. It looks poluted.",250);break;case "backpack":f(a.a,"Exactly what I need for carrying more things.",300);break;case "touch of death":f(a.a,"The label reads 'Aim, fire, instant death!'",250,function(){f(a.a,"How morbid.",140)});break;case "black key":f(a.a,"It looks vaguely familiar.",250);break;case "me":f(a.a,"I look like the Grim Reaper. Is that who I am?",
200);break;case "reaper":f(a.a,"He looks like me but older.",270,function(){a.f[12]&&f(a.a,"I think he's dead now.",270)});break;case "doll":f(a.a,"This thing looks genuinely scary.",200);break;case "sign":f(a.a,"Its a street sign that says '"+a.sign.innerHTML+"'",200);break;case "crossing":f(a.a,"A safe way to cross the street, even for the Reaper.",200);break;default:""!=d&&f(a.a,"It's just a "+d+".",190)}break;case "Eat":switch(d){case "chocolate coins":f(a.a,"Yummy! Plenty more where that came from.",
200);break;default:f(a.a,"Uh... No.",130)}break;case "Talk to":switch(d){case "reaper":if(a.f[12])f(a.a,"He's dead... unfortunately.",200);else{let k=new p(50);k.c.style.opacity=0;k.add();k.setPosition(680,0,530);k.c.style.transition="opacity 0.5s";k.c.style.opacity=.3;f(k,"Uh! Please, help!",200,function(){f(a.a,"Who are you?",170,function(){f(k,"I am you, from the future.",200,function(){f(k,"Back in 2025, we got a cold. We call it The Death.",300)})})})}break;case "me":f(a.a,"Isn't that what I'm doing?",
150);break;default:f(a.a,"There was no reply.",220)}break;case "Open":switch(d){case "drain":f(a.a,"They won't budge.",230);break;case "door":a.a.moveTo(a.g.offsetLeft+a.g.offsetWidth/2,a.a.z,function(){a.f[9]||a.v?a.f[8]?f(a.a,"The door is alrleady open.",230):(a.g.children[0].style.transform=a.v?"rotateY(180deg)":"rotateY(-45deg)",a.f[8]=!0):f(a.a,"The door is locked.",230)});break;default:f(a.a,"It doesn't open.",230)}break;case "Close":switch(d){case "door":a.f[8]?a.a.moveTo(a.g.offsetLeft+a.g.offsetWidth/
2,a.a.z,function(){a.g.children[0].style.transform="";a.f[8]=!1}):f(a.a,"It is already closed.",220);break;default:f(a.a,"It doesn't close.",220)}break;case "Use":if(c==b)h="Use "+d+" with ";else{let k=c.substring(4,c.indexOf(" with "));if(-1<k.indexOf(" key"))if(a.b.T(k))switch(d){case "door":a.a.moveTo(a.g.offsetLeft+a.g.offsetWidth/2,a.a.z,function(){a.f[9]||a.v?f(a.a,"I don't want to lock it again.",220):{"green key":41}[k]==a.b.i?(a.f[9]=!0,f(a.a,"The door is now unlocked.",220)):f(a.a,"It's the wrong key for this door.",
220)});break;default:f(a.a,"Nothing happened.",220)}else f(a.a,"I don't have the "+k,220);else if("touch of death"==k)switch(d){case "me":f(a.a,"It doesn't work on me.",200);break;case "reaper":f(a.a,"Strange... It doesn't work on him.",200);break;case "ghost":f(a.a,"They're already dead.",200);break;default:f(a.a,"Nothing happened.",220)}h=b}break;case "Give":if(c==b)h="Give "+d+" to ";else{switch(c+d){case "Give doll to reaper":a.b.h=!1;a.a.moveTo(a.a.u,600,function(){a.a.moveTo(a.j.x,600,function(){a.j.moveTo(a.j.x+
200,600,function(){a.j.setDirection(a.Ta.Sa);f(a.j,"Get that thing away from me!!",300,function(){a.b.S(a.j.c);a.j.moveTo(850,600,function(){a.b.F[0][0]=0;a.b.F[4][0]=4;a.b.la(a.b.F[4]);a.b.ka(a.b.F[4][7].c);a.j.remove();f(a.a,"Whoa! He didn't like that.",300);a.b.ma(84)})})})})});break;default:"me"==d?f(a.a,"You lost me at 'Give'",260):f(a.a,"I think it said no.",230)}h=b}break;case "Pick up":a.b.T(d)?f(a.a,"I already have that.",140):a[l]&&a[l].item?a.b.T("backpack")||"backpack"==d||2>a.items.children.length?
a.a.moveTo(a.a.u,600,function(){a.a.moveTo(a[l].x,600,function(){a.b.getItem(d);a[l].remove();a[l].La[0]=0;a.b.ma(15);"backpack"==d&&(a.a.sa="rgb(20, 30, 20)",a.a.canvas=t(a.a),f(a.a,"Nice fit!",150))})}):f(a.a,"My hands are full. I need a bag of some kind.",220):f(a.a,"I can't get that.",220);break;default:f(a.a,"Nothing happened.",220)}return h}};class v{constructor(b,c,d){this.y=this.z=this.x=0;this.c=document.createElement("span");let e=this.c.style;this.width=b;this.height=c;e.width=this.width+"px";e.height=this.height+"px";this.na=d;this.i=a.b.i}setPosition(b,c,d){this.x=b;this.z=d;this.y=c;this.c.style.top=Math.floor(this.z/2)-this.height-Math.floor(this.y)+"px";this.c.style.left=this.x+"px";this.c.style.zIndex=this.na?this.na:Math.floor(this.z)}add(){a.screen.appendChild(this.c)}remove(){try{a.screen.removeChild(this.c)}catch(b){}}Z(){return!1}update(){}U(){}}
;class w extends v{constructor(b,c,d,e,h){super(b,c,0);this.M=!1;this.D=[];this.G=b/2;this.Ca=d;this.c.classList.add("sprite");this.J=this.u=0;this.ha=h;this.step=this.Pa=this.ha/10;this.direction=0;this.heading=null;this.Aa=this.oa=0;this.facing=1;this.B=this.C=-1;this.P=null;this.R=[];this.I=0}Z(b,c){if(!this.L&&!b.L&&b){let d=this.u-b.u,e=this.J-b.J,h=Math.abs(this.z-b.z)+15;b=this.G+b.G+(c|0);return d*d+e*e+h*h<=b*b}return!1}reset(){let b=this.D.pop();b&&(this.setPosition(b.x,b.y,b.z),this.D.pop());
this.step=1;return b}setPosition(b,c,d){this.z&&(this.D.push({x:this.x,y:this.y,z:this.z}),5<this.D.length&&(this.D=this.D.slice(-5)));this.x=b;this.y=c;this.z=d;this.u=b+this.G;this.J=c+this.G;this.c.style.top=Math.floor(this.z/2)-this.height-Math.floor(this.y)+"px";this.c.style.left=this.x+"px";this.c.style.zIndex=Math.floor(this.z)}setDirection(b){if(b&&b!=this.direction){this.direction=b;for(var c=0;4>=c&&!(b>>c++&1););this.facing=c}this.canvas&&this.canvas.width>this.width&&(this.oa=-((this.facing-
1)*this.width),this.c.style.backgroundPosition=this.oa+"px "+(this.Aa+~~(this.I/10)*this.height)+"px")}move(){this.M=!1;if(this.direction||null!=this.heading){var b=this.x,c=this.z,d=this.y,e=0;null!=this.heading&&(b+=Math.cos(this.heading)*Math.round(this.step*a.b.wa),c+=Math.sin(this.heading)*Math.round(this.step*a.b.wa),a.b.h||this!=a.a?(0>b&&(e=1),960<b+this.width&&(e=6),667<c&&(e=10)):(680<c&&740>c&&(c=this.direction==x?740:680),950<c&&(e=7)),530>c&&(this==a.a?(this==a.a&&(a.b.h=!1),this.c.style.opacity=
1-(530-c)/100):e=480>b?100>b?2:3:860>b?4:5),500>c&&(e=480>b?100>b?2:3:860>b?4:5),(this.step+=this.Pa)>this.ha&&(this.step=this.ha));if(e)this.V(e);else if(b!=this.x||c!=this.z)this.setPosition(b,d,c),this.M=!0}else this.step=1}update(){this.M||this.move()}U(){this.M&&this.reset()}V(b){b&&this.stop()}}var x=8,y=[1,2,4,x];function f(b,c,d,e){a.b.h=!1;let h=document.createElement("span");h.className="bubble";h.innerHTML=c;let l;l=800<b.x?-d+40:100>b.x?-10:-(d/2);h.style.width=d+"px";h.style.left=l+"px";let k=b.c;k.appendChild(h);k.classList.add("speech");setTimeout(function(){k.classList.remove("speech");k.removeChild(h);setTimeout(function(){e?e():a.b.h=!0},500)},c.length/10*1500)}
function t(b){let c=a.m.ba(4*b.width,9*b.width);for(let d=0;3>d;d++)for(let e=0;4>e;e++)c.drawImage(a.m.Ma(b.width,3*b.width,e,d,b.Ba,b.Ca,b.Ga,b.sa,b.Ea),e*b.width,d*b.width*3);b.c.style.backgroundImage="url("+c.canvas.toDataURL("image/png")+")";return c.canvas}
class z extends w{constructor(b,c,d,e,h,l,k,q,m){super(b,c,d,e,h);this.Ba=l;this.Ga=k;this.sa=q;this.Ea=m;this.canvas=t(this);this.c.classList.add("actor")}stop(b){this.B=this.C=-1;this.heading=null;this.I=0;this.P&&(this.P(),this.P=null);b&&(this.R=[])}moveTo(b,c,d){this.R.push({z:c,x:b,Fa:d})}update(){if("none"!=this.c.style.display){let b;if(-1!=this.B&&-1!=this.C)this.Z({u:this.B,J:this.J,z:this.C,G:-this.G},20)?this.stop():(this.heading=Math.atan2(this.C-this.z,this.B-this.u),this.I=(this.I+
1)%30);else if(0<this.R.length){let c=this.R.shift();this.C=c.z;this.B=c.x;this.P=c.Fa}null!==this.heading&&(b=2.356<Math.abs(this.heading)?b|1:.785>Math.abs(this.heading)?b|2:0<this.heading?b|x:b|4);this.setDirection(b);null!==this.heading&&this.move()}}U(b){for(;this.reset()&&this.Z(b););}};class A extends z{constructor(){super(50,150,"black",.95,5,"black",null,null);this.c.classList.add("ego");this.c.id="me";this.s=2;this.setDirection(x)}V(b){if(b&&(this.B=this.C=-1,this.heading=null,this.I=0,10>b)){let c=a.b.ua[this.i-1][b];if(c){a.b.h=!1;this.c.style.display="none";this.c.style.opacity=1;this.i=c;switch(b){case 1:this.setPosition(960+this.width,this.y,600);this.setDirection(1);this.moveTo(960-this.width-50,600,function(){a.b.h=!0});break;case 2:this.setPosition(885,this.y,500);this.setDirection(x);
this.moveTo(910,600,function(){a.b.h=!0});this.s=this.s+1&3;break;case 3:this.setPosition(645,this.y,500);this.setDirection(x);this.moveTo(670,600,function(){a.b.h=!0});break;case 4:this.setPosition(268,this.y,500);this.setDirection(x);this.moveTo(293,600,function(){a.b.h=!0});break;case 5:this.setPosition(25,this.y,500);this.setDirection(x);this.moveTo(50,600,function(){a.b.h=!0});this.s=this.s-1&3;break;case 6:this.setPosition(-(2*this.width),this.y,600);this.setDirection(2);this.moveTo(this.width+
50,600,function(){a.b.h=!0});break;case 7:this.setDirection(4),this.moveTo(a.a.x,600,function(){a.b.h=!0}),this.s=this.s+2&3}this.step=1}}}};function B(b){b.setDirection(y[a.b.random(4)-1]);var c=b.direction;b.heading=Math.atan2(((c&8)>>3)-((c&4)>>2),((c&2)>>1)-(c&1))}class p extends z{constructor(b){super(b,3*b,"grey",.95,.5,"grey",null,null,"grey");this.c.className="ghost";B(this);this.L=!0}update(){super.update();1==a.b.random(200)&&300<this.x&&600>this.x&&B(this)}V(b){super.V(b);B(this)}};a.b={ga:0,pa:0,h:!0,fa:481731,ua:[[25,,2,,,8,,41],[17,3,,,,1,,22],[17,4,,,,,2,21],[17,,5,,,,3,20],[27,,6,,,4,,35],[20,7,,,,5,,31],[20,8,,,,,6],[20,,1,,,,7,25],[41,10,,,,22,,69],[41,11,,,,,9,68],[41,12,,,,,10],[41,,13,,,,11,91],[35,14,,,,12,,28],[35,15,,,,,13],[35,,16,,,,14,34],[43,17,,,,15,,53],[43,18,,,,,16],[43,19,,,,,17,48],[43,,20,,,,18,47],[33,21,,,,19,,4],[33,22,,,,,20,3],[33,,9,,,,21,2],[57,24,,,,28,,89],[57,,25,,,,23,88],[52,,26,,,24,,8],[58,27,,,,25,,],[58,,28,,,,26],[51,,23,,,27,,13],[74,
30,,,,34,,],[74,,31,,,,29],[68,,32,,,30,,6],[75,33,,,,31,,58],[75,,34,,,,32,57],[67,,29,,,33,,15],[59,,36,,,46,,5],[49,37,,,,35,,52],[49,38,,,,,36],[49,39,,,,,37,72],[49,40,,,,,38,71],[49,,41,,,,39,70],[57,,42,93,,40,,1,,,"green"],[52,43,,,,41,,87],[52,44,,,,,42],[52,45,,,,,43,77],[52,46,,,,,44],[52,,35,,,,45,59],[75,48,,,,52,,19],[75,,49,,,,47,18],[66,,50,,,48,,56],[76,51,,,,49,,64],[76,,52,,,,50,63],[65,,47,,,51,,36],[11,,54,,,56,,16],[3,,55,,,53,,62],[12,,56,,,54,,73],[2,,53,,,55,,49],[27,58,,
,,62,,33],[27,,59,,,,57,32],[20,,60,,,58,,46],[28,61,,,,59,,76],[28,,62,,,,60,75],[19,,57,,,61,,54],[44,64,,,,72,,51],[44,,65,,,,63,50],[34,66,,,,64,,82],[34,67,,,,,65],[34,,68,,,,66,92],[41,69,,,,67,,10],[41,,70,,,,68,9],[33,71,,,,69,,40],[33,72,,,,,70,39],[33,,63,,,,71,38],[60,74,,,,82,,55],[60,75,,,,,73],[60,76,,,,,74,61],[60,,77,,,,75,60],[52,,78,,,76,,44],[61,79,,,,77,,86],[61,80,,,,,78,85],[61,81,,,,,79,84],[61,,82,,,,80,83],[50,,73,,,81,,65],[13,84,,,,92,,81],[13,85,,,,,83,80],[13,86,,,,,84,
79],[13,,87,,,,85,78],[4,,88,,,86,,42],[9,89,,,,87,,24],[9,90,,,,,88,23],[9,91,,,,,89],[9,,92,,,,90,12],[2,,83,,,91,,67],[128,,,,41,,,,,,"green"]],flags:{},F:[[62,1,"green_key",18,3,455,540,null],[23,2,"light_beam",100,264,613,520,null,900],[41,0,"reaper",50,150,710,650,null],[41,1,"time_machine",20,15,680,510,null],[41,1,"black_key",18,3,750,510,null],[93,1,"backpack",30,40,380,530,null]],w:[],W:{},$:"Walk to",A:"Walk to",o:"",ea:-1,aa:!0,N:0,time:2030,qa:function(){a.X=window.innerWidth/a.H.offsetWidth;
a.Y=window.innerHeight/a.H.offsetHeight;a.H.style.transform="scale3d("+a.X+", "+a.Y+", 1)";a.H.style.marginLeft=(window.innerWidth-960)/2+"px";a.screen.style.width=(960<window.innerWidth?window.innerWidth:960)+"px"},start:function(){a.H=document.getElementById("wrap");a.screen=document.getElementById("screen");a.O=document.getElementById("wall");a.K=document.getElementsByClassName("door");a.Ua=document.getElementsByClassName("drain");a.ta=document.getElementsByClassName("path");a.time=document.getElementById("time");
a.N=document.getElementById("score");a.items=document.getElementById("itemlist");a.Oa=document.getElementById("sentence");a.controls=document.getElementById("controls");a.sign=document.getElementById("sign");a.Da=document.getElementById("crossing");a.ia=document.getElementById("msg");this.qa();window.addEventListener("resize",function(){a.b.qa()});this.O=this.Na();a.screen.style.backgroundImage="url("+this.O.toDataURL("image/png")+")";document.getElementById("up").addEventListener("click",function(){a.b.va(1)});
document.getElementById("down").addEventListener("click",function(){a.b.va(-1)});for(var b=document.getElementById("commands").children,c=0;c<b.length;c++)b[c].addEventListener("click",function(d){a.b.A=a.b.$=d.target.innerHTML});this.Ha()},Ha:function(){this.S(a.screen);this.ca(a.ia);window.onclick=function(){a.b.S(a.ia);setTimeout(function(){a.ia.style.display="none"},200);setTimeout(function(){a.b.Ia();a.b.loop()},500)}},Ia:function(){this.aa=!1;window.onclick=null;document.fullscreenEnabled&&
document.documentElement.requestFullscreen();a.screen.onclick=function(c){a.b.ja(c)};this.setTime(2030);if(this.l)for(var b=0;b<this.l.length;b++)this.l[b].remove();this.l=[];this.i=41;a.a=new A;a.a.add();a.a.setPosition(500,0,600);this.za(200);this.getItem("touch of death");this.ra();this.ca(a.H)},ya:function(b){a.b.loop(b)},loop:function(b){requestAnimationFrame(this.ya);this.Qa(b);this.Ra();a.Oa.innerHTML=this.aa?"Game Over":this.A+" "+this.o;a.a.i!=this.i&&(this.i=a.a.i,this.S(a.screen),setTimeout(function(){a.b.ra()},
200));a.H.style.cursor=a.b.h?"crosshair":"wait"},Qa:function(b){this.pa=b-(this.ga?this.ga:b-16);this.wa=.06*this.pa;this.ga=b},Ra:function(){for(var b=-1,c,d=a.a,e,h=this.l.length;;){if(d){d.update();for(c=b+1;c<h;c++)(e=this.l[c])&&d.Z(e)&&(d.U(e),e.U(d));d.M=!1}if(++b<h)d=this.l[b];else break}},setTime:function(b){a.time.innerHTML=""+b+" AD"},ma:function(b){this.N+=b;a.N.innerHTML=""+this.N+" of 230"},ja:function(b){this.h&&!this.aa&&(this.A=a.xa.Ka(this.$,this.A,this.o,b),b&&b.stopPropagation(),
this.A==this.$&&(this.A=this.$="Walk to"))},za:function(b){for(var c=0;92>=c;c++)this.w[c]=[];for(c=0;c<b;c++)this.w[this.random(92)].push(null);this.w[41]=[]},random:function(b){this.fa=1664525*this.fa+1013904223&4294967295;return(this.fa&65535)%b+1},ra:function(){for(var b=0;b<this.l.length;b++)this.l[b].remove();this.l=[];a.f=this.ua[this.i-1];a.v=a.f[0]&128;a.screen.className=a.v?"inside":"outside";a.O.className="";a.v||a.O.classList.add("bricks");b="";a.f[2]&&(b+="left");a.f[5]&&(b+="right");
b&&a.O.classList.add(b);a.sign.className=b;a.ta[0].style.display=a.f[2]?"block":"none";a.ta[1].style.display=a.f[5]?"block":"none";a.K[0].style.display=a.f[3]?"block":"none";a.K[1].style.display=a.f[4]?"block":"none";a.g="block"==a.K[0].style.display?a.K[0]:a.K[1];a.g.children[0].className=a.f[10];a.v&&(a.g.children[0].style.transform="rotateY(180deg)",a.g.style.overflow="visible",a.f[8]=!0);a.Da.style.display=a.f[7]?"block":"none";var c=a.f[0]&7;let d=(a.f[0]&8?" Avenue ":" Street ")+"NESW".charAt(a.a.s);
a.sign.innerHTML=b?c+this.Ja(c)+d:"";a.sign.style.display=b?"block":"none";for(c=0;c<this.F.length;c++)b=this.F[c],b[0]==this.i&&this.la(b);if(93>this.i)for(b=0;b<this.w[this.i].length;b++)c=this.w[this.i][b],null==c&&(c=this.w[this.i][b]=new p(1==this.random(3)?35:48)),c.add(),0==c.x&&c.setPosition(this.random(880)+20,0,this.random(120)+540),this.l.push(c);b=a.screen.children;for(c=0;c<b.length;c++)this.ka(b[c]);a.b.ca(a.screen);a.a.c.style.display="block"},Ja:function(b){return["st","nd","rd"][((b+
90)%100-10)%10-1]||"th"},la:function(b){var c;if(c=b[7])c.add();else{switch(b[1]){case 0:switch(b[2]){case "reaper":c=new z(b[3],b[4],"black",.95,10,"black");c.setDirection(1);c.L=!0;break;case "doll":c=new z(b[3],b[4],"#111",.95,5,"#111"),c.setDirection(x)}c.setPosition(b[5],0,b[6]);break;case 1:c=new v(b[3],b[4],b[8]);c.item=!0;break;case 2:c=new v(b[3],b[4],b[8])}if(-1<b[2].indexOf("_")){let d=b[2].split("_");for(let e=0;e<d.length;e++)c.c.classList.add(d[e])}a[b[2]]=c;c.c.id=b[2];c.La=b;c.add();
c.setPosition(b[5],0,b[6]);b[7]=c}this.l.push(c)},ka:function(b){b.onmouseenter=function(c){a.b.o=c.target.id?c.target.id.replace("_"," "):c.target.className};b.onmouseleave=function(){a.b.o=""};b.onclick=function(c){let d=!c.target.className||"door"==c.target.parentElement.className;a.b.o=c.target.id?c.target.id.replace("_"," "):d?c.target.parentElement.className:c.target.className;a.b.ja(c)}},getItem:function(b){var c=document.createElement("span");c.innerHTML=b;a.items.appendChild(c);c.addEventListener("mouseenter",
function(){a.b.o=b});c.addEventListener("mouseleave",function(){a.b.o=""});c.addEventListener("click",function(d){a.b.o=b;a.b.ja(d)});this.W[b]=c},T:function(b){return this.W.hasOwnProperty(b)},Va:function(b){a.items.removeChild(this.W[b]);delete this.W[b]},va:function(b){b=this.ea+27*b;var c=a.items.children.length;-1>=b&&b>-(27*(c-4))&&(this.ea=b,a.items.style.top=this.ea+"px")},Na:function(){var b=a.m.ba(960,260);b.fillStyle="hsl(0, 0%, 10%)";b.fillRect(0,0,960,260);for(var c=b.getImageData(0,
0,960,260),d=0;d<c.data.length;d+=4){var e=.5*Math.random();.1>e?(e=1-e,c.data[d]=Math.floor(c.data[d]*e),c.data[d+1]=Math.floor(c.data[d+1]*e),c.data[d+2]=Math.floor(c.data[d+2]*e),c.data[d+3]=200):(e=.5+e,c.data[d]=Math.floor(c.data[d]/e),c.data[d+1]=Math.floor(c.data[d+1]/e),c.data[d+2]=Math.floor(c.data[d+2]/e))}b.putImageData(c,0,0);return b.canvas},ca:function(b){b.style.transition="opacity 0.5s";b.style.opacity=1},S:function(b){b.style.transition="opacity 0.2s";b.style.opacity=0}};
window.onload=function(){a.b.start()};</script>
</body>
</html>