-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
484 lines (426 loc) · 12.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Zombie City Adventure</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Leaflet CSS -->
<link
rel="stylesheet"
href="https://unpkg.com/leaflet/dist/leaflet.css"
/>
<!-- Leaflet JavaScript -->
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
<!-- ml5.js Library -->
<script src="https://unpkg.com/ml5@0.6.1/dist/ml5.min.js"></script>
<script src="./sketch.js"></script>
<script src="./modal.js"></script>
<style>
/* Reset default margins and paddings */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body, html, #map {
height: 100%;
width: 100%;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
/* Start Screen Styling */
#startScreen {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('images/bg.webp') no-repeat center center/cover;
z-index: 3000;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
color: #fff;
text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
transition: opacity 0.5s ease, visibility 0.5s ease;
}
#startScreen.hidden {
opacity: 0;
visibility: hidden;
}
#startContent h1 {
font-size: 60px;
margin-bottom: 40px;
letter-spacing: 2px;
}
#healthDisplay {
position: absolute;
top: 20px;
right: 20px;
z-index: 1000;
background: rgba(0, 0, 0, 0.6);
padding: 10px 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0,0,0,0.5);
font-size: 16px;
color: #fff;
display: none; /* Hidden initially */
}
#citySelect {
padding: 12px 20px;
font-size: 18px;
border: none;
border-radius: 8px;
margin-bottom: 30px;
margin-top:20px;
width: 220px;
text-align: center;
background: rgba(255, 255, 255, 0.9);
color: #333;
font-weight: bold;
cursor: pointer;
appearance: none;
background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="10"><path fill="%23333" d="M7 10L0 0h14z"/></svg>');
background-repeat: no-repeat;
background-position: right 10px center;
background-size: 14px 10px;
}
#startGameButton {
padding: 14px 28px;
font-size: 20px;
color: #fff;
background: linear-gradient(45deg, #ff6b6b, #f06595);
border: none;
border-radius: 12px;
cursor: pointer;
box-shadow: 0 6px 12px rgba(0,0,0,0.3);
transition: transform 0.2s, box-shadow 0.2s;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#startGameButton:hover {
transform: translateY(-3px);
box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}
#startGameButton:active {
transform: translateY(0);
box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}
/* Controls Styling */
#controls {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
background: rgba(0, 0, 0, 0.6);
padding: 10px 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0,0,0,0.5);
display: none; /* Hidden initially */
}
#controls button {
padding: 8px 16px;
font-size: 16px;
color: #fff;
background: linear-gradient(45deg, #1e90ff, #00ced1);
border: none;
border-radius: 8px;
cursor: pointer;
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
transition: transform 0.2s, box-shadow 0.2s;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#controls button:hover {
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}
#controls button:active {
transform: translateY(0);
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
/* Status Message Styling */
#status {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
background: rgba(0, 0, 0, 0.6);
padding: 10px 20px;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0,0,0,0.5);
font-size: 16px;
color: #fff;
text-align: center;
display: none; /* Hidden initially */
}
/* Player Marker Styling */
.player-marker {
width: 20px;
height: 20px;
background-color: red;
border: 3px solid white;
border-radius: 50%;
box-shadow: 0 0 5px rgba(0,0,0,0.7);
}
/* Escape Marker Styling */
.escape-marker {
width: 32px;
height: 32px;
background-image: url('images/gate.png'); /* Replace with your escape icon */
background-size: cover;
background-repeat: no-repeat;
border: 2px solid white;
border-radius: 50%;
box-shadow: 0 0 5px rgba(0,0,0,0.7);
}
/* Video and Canvas Styling */
#videoContainer {
position: absolute;
bottom: 20px;
right: 20px;
width: 160px;
height: 120px;
z-index: 1000;
border: 2px solid #ccc;
border-radius: 8px;
overflow: hidden;
background: #000;
display: none; /* Hidden initially */
}
#video {
width: 100%;
height: 100%;
transform: scaleX(-1); /* Mirror the video for natural interaction */
}
#overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none; /* Allow clicks to pass through */
}
/* Capture Overlay Styling */
#captureOverlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.85); /* Semi-transparent black background */
display: none; /* Hidden by default */
justify-content: center;
align-items: center;
flex-direction: column; /* Arrange items vertically */
z-index: 4000; /* Above all other elements */
color: #fff;
text-align: center;
padding: 20px;
}
#captureOverlay img {
max-width: 80%;
max-height: 60%;
border: 4px solid #fff;
border-radius: 12px;
box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
margin-bottom: 30px;
}
/* Restart Game Button Styling */
#restartButton {
padding: 14px 28px;
font-size: 20px;
color: #fff;
background: linear-gradient(45deg, #ff6b6b, #f06595);
border: none;
border-radius: 12px;
cursor: pointer;
box-shadow: 0 6px 12px rgba(0,0,0,0.4);
transition: transform 0.2s, box-shadow 0.2s;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#restartButton:hover {
transform: translateY(-3px);
box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}
#restartButton:active {
transform: translateY(0);
box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}
/* Map Styling */
#map {
display: none; /* Hidden initially */
}
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1000; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgba(0,0,0,0.8); /* Black w/ opacity */
}
.modal-content {
background-color: #fefefe;
margin: 15% auto; /* 15% from the top and centered */
padding: 20px;
border: 1px solid #888;
width: 80%; /* Could be more or less, depending on screen size */
}
.close-button {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close-button:hover,
.close-button:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
.icon-item {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.icon-item img {
width: 50px; /* Adjust size as needed */
height: auto;
margin-right: 10px; /* Space between icon and text */
}
#trainingModal {
display: none;
position: fixed;
z-index: 2000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.8);
}
.modal-content {
background-color: #fefefe;
margin: 10% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
text-align: center;
}
#trainingGrid {
width: 300px;
height: 300px;
margin: 20px auto;
border: 2px solid #333;
position: relative;
}
#trainingBall {
width: 20px;
height: 20px;
background-color: red;
border-radius: 50%;
position: absolute;
top: 140px;
left: 140px;
transition: all 0.3s ease;
}
#trainingControls {
margin-top: 20px;
}
#trainingControls button {
padding: 10px 20px;
font-size: 16px;
margin: 0 10px;
}
</style>
</head>
<body>
<!-- Start Screen -->
<div id="startScreen" class="visible">
<h1>Zombie City Adventure</h1>
<input list="list-of-cities" id="citySelect" name="city-choice" />
<datalist id="list-of-cities">
<option value="Bournemouth">Bournemouth</option>
<option value="Lagos">Lagos</option>
<option value="London">London</option>
<option value="Port Harcourt">Port Harcourt</option>
<option value="New York">New York</option>
<option value="Tokyo">Tokyo</option>
<option value="Paris">Paris</option>
<option value="Berlin">Berlin</option>
</datalist>
<button id="startGameButton">Start Game</button>
</div>
<!-- Controls -->
<div id="controls">
<button onclick="toggleGame()">Stop Game</button>
<button onclick="openModal()">Show Icon Guide</button>
</div>
<!-- Status Message -->
<div id="status">Press "Start Game" to begin.</div>
<div id="healthDisplay">Health: 100</div>
<!-- Video and Canvas for Hand Control -->
<div id="videoContainer">
<video id="video" autoplay muted playsinline></video>
<canvas id="overlay"></canvas>
</div>
<!-- Capture Overlay -->
<div id="captureOverlay">
<img src="images/Caught.jpg" alt="Captured">
<button id="restartButton" onclick="restartGame()">Restart Game</button>
</div>
<!-- Map -->
<div id="map"></div>
<div id="p5-canvas"></div>
<!-- Icon Guide Modal -->
<div id="iconGuideModal" class="modal">
<div class="modal-content">
<span class="close-button" onclick="closeModal()">×</span>
<h2>Icon Guide</h2>
<div class="icon-item">
<img src="images/Playericon.png" alt="Player Icon" />
<p><strong>Player:</strong> Your character in the game.</p>
</div>
<div class="icon-item">
<img src="images/gate.png" alt="Escape Icon" />
<p><strong>Escape Point:</strong> Reach this point to win the game.</p>
</div>
<div class="icon-item">
<img src="images/safe-zone.webp" alt="Safe Zone Icon" />
<p><strong>Safe Zone:</strong> Temporary immunity from opponents.</p>
</div>
<div class="icon-item">
<img src="images/collectibles/health.webp" alt="Health Icon" />
<p><strong>Health Pack:</strong> Restores health when collected.</p>
</div>
<div class="icon-item">
<img src="images/collectibles/invincibility.webp" alt="Health Icon" />
<p><strong>Invincibility Pack:</strong> Makes you invincible to opponents</p>
</div>
<div class="icon-item">
<img src="images/collectibles/speed.webp" alt="Health Icon" />
<p><strong>Speed Pack:</strong> Makes you faster</p>
</div>
</div>
</div>
<!-- Training Modal -->
<div id="trainingModal" class="modal">
<div class="modal-content">
<h2>Hand Gesture Training</h2>
<p>Practice moving the ball using your hand gestures. Move your palm in the direction you want the ball to go.</p>
<div id="trainingGrid">
<div id="trainingBall"></div>
</div>
<div id="trainingControls">
<button id="skipTrainingButton">Skip Training</button>
<button id="startGameFromTrainingButton">Start Game</button>
</div>
</div>
</div>
<script src="./index.js"></script>
</body>
</html>