-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
552 lines (500 loc) · 20 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>No One Can See You</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
<style>
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes glitch {
0% { transform: translate(0) }
20% { transform: translate(-2px, 2px) }
40% { transform: translate(-2px, -2px) }
60% { transform: translate(2px, 2px) }
80% { transform: translate(2px, -2px) }
100% { transform: translate(0) }
}
.custom-modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
z-index: 1000;
}
.modal-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #000;
border: 2px solid #00ff00;
box-shadow: 0 0 20px #00ff00;
padding: 20px;
max-width: 80%;
width: 400px;
color: #00ff00;
font-family: 'Courier New', monospace;
animation: fadeIn 0.3s;
}
.game-title {
font-family: monospace;
animation: glitch 0.5s infinite;
color: #00ff00;
text-shadow: 2px 2px #ff0000, -2px -2px #0000ff;
}
.fade-in {
animation: fadeIn 1s ease-in;
}
.neon-button {
background: #000;
color: #fff;
border: 2px solid #00ff00;
padding: 10px 20px;
margin: 5px;
transition: all 0.3s;
text-shadow: 0 0 5px #00ff00;
box-shadow: 0 0 10px #00ff00;
}
.neon-button:hover {
background: #00ff00;
color: #000;
box-shadow: 0 0 20px #00ff00;
}
.game-container {
background: #000;
color: #00ff00;
font-family: 'Courier New', monospace;
border: 3px solid #00ff00;
box-shadow: 0 0 20px #00ff00;
}
#health-bar {
height: 20px;
background: #ff0000;
transition: width 0.5s;
}
.terminal-text {
border-left: 2px solid #00ff00;
padding-left: 5px;
animation: blink 1s step-end infinite;
}
.inventory-item {
cursor: pointer;
}
.inventory-item:hover {
background: #1a1a1a !important;
box-shadow: 0 0 10px #00ff00;
}
@keyframes blink {
50% { border-color: transparent; }
}
</style>
</head>
<body class="bg-black min-h-screen">
<div id="customModal" class="custom-modal">
<div class="modal-content rounded-lg">
<h3 id="modalTitle" class="text-xl mb-4"></h3>
<p id="modalMessage" class="mb-4"></p>
<button onclick="closeModal()" class="neon-button w-full">Continue</button>
</div>
</div>
<div class="container mx-auto p-4">
<div class="game-container p-6 rounded-lg fade-in">
<h1 class="game-title text-4xl mb-6 text-center">No One Can See You</h1> <button onclick="showHowToPlay();">What is this Game? / How to Play</button>
<div class="mb-4">
<div class="w-full bg-gray-800 rounded">
<div id="health-bar" class="rounded" style="width: 100%"></div>
</div>
<div class="text-sm text-center">Health</div>
</div>
<div id="level-info" class="mb-6">
<h2 class="text-xl mb-2">Level <span id="level-number">1</span></h2>
<div id="level-description" class="terminal-text p-4 bg-gray-900 rounded"></div>
</div>
<div id="choices" class="grid grid-cols-1 gap-4">
<!-- Buttons will be dynamically inserted here -->
</div>
<div id="inventory" class="mt-6 p-4 bg-gray-900 rounded">
<h3 class="text-xl mb-2">Inventory</h3>
<div id="inventory-items" class="grid grid-cols-3 gap-2">
<!-- Inventory items will be displayed here -->
</div>
</div>
</div>
</div>
<script src="https://static.elfsight.com/platform/platform.js" async></script>
<div class="elfsight-app-8ce979bb-5626-49ac-9261-a145bd9d5fac" data-elfsight-app-lazy></div>
<script>
const levels = [
{
description: "Your neighbor is mowing grass... oh no, you're allergic to grass! The clippings are flying everywhere. What do you do?",
choices: [
{
text: "Close all windows",
outcome: "Oh no! You missed a small slit in the window. Grass touched you!",
deathReason: "Severe allergic reaction to grass through the window slit",
healthEffect: -30
},
{
text: "Hack neighbor's mind to stop mowing",
outcome: "Success! You've gained mind control powers!",
healthEffect: 0,
itemGained: "Mind Control Device"
},
{
text: "Talk to neighbor",
outcome: "You were seen!",
deathReason: "Cover blown by direct contact",
healthEffect: -100
}
]
},
{
description: "Government drones are scanning the area. Your stealth is being tested!",
choices: [
{
text: "Use mind control on operator",
outcome: "The drones are now yours!",
healthEffect: 0,
itemGained: "Drone Control"
},
{
text: "Hide under a tree",
outcome: "Thermal cameras spotted you!",
deathReason: "Detected by advanced thermal imaging",
healthEffect: -40
},
{
text: "Bribe the operator",
outcome: "Police spotted you on the way",
deathReason: "Cover blown by direct contact",
healthEffect: -100
}
]
},
{
description: "A suspicious figure is watching you from the shadows. What do you do?",
choices: [
{
text: "Approach and talk to them",
outcome: "It's an agent from the resistance! They offer you help.",
healthEffect: 10,
itemGained: "Resistance Contact"
},
{
text: "Run and hide in a nearby alley",
outcome: "You escape unnoticed, but they now know you're aware of them.",
healthEffect: 0
},
{
text: "Confront them with your mind control",
outcome: "You successfully take control, but it feels like you're being watched by someone more powerful.",
healthEffect: -20,
itemGained: "Cautionary Insight"
}
]
},
{
description: "You’re in an underground hacker den. The mission is clear, but security is tight.",
choices: [
{
text: "Use the backdoor code you stole earlier",
outcome: "You bypassed the system, but now a silent alarm is going off.",
healthEffect: -10,
itemGained: "Emergency Escape Plan"
},
{
text: "Try to hack the mainframe directly",
outcome: "The firewall detected you and launched a counterattack.",
deathReason: "Overwhelmed by counter-hacking AI",
healthEffect: -70
},
{
text: "Blend in and wait for an opportunity",
outcome: "Patience paid off! You find a hidden terminal with no security.",
healthEffect: 10,
itemGained: "Access Key"
}
]
},
{
description: "A virus has infected your system. Time to take action!",
choices: [
{
text: "Use a self-healing program",
outcome: "The virus is eradicated! But your system feels a little unstable.",
healthEffect: 0,
itemGained: "Stabilized System"
},
{
text: "Manually trace the virus's origin",
outcome: "The virus was a trap! Now you’re locked out of your own system.",
deathReason: "System lockdown",
healthEffect: -30
},
{
text: "Disconnect from the network and reboot",
outcome: "You lost some progress, but you're safe for now.",
healthEffect: 5
}
]
},
{
description: "A mysterious object lands nearby. You approach cautiously.",
choices: [
{
text: "Investigate the object",
outcome: "It's a data beacon, containing critical info for your mission!",
healthEffect: 10,
itemGained: "Encrypted Data"
},
{
text: "Ignore it and move on",
outcome: "You never know... it could have been something important.",
healthEffect: 0
},
{
text: "Destroy the object with your mind control",
outcome: "The object activates an unexpected self-destruct sequence!",
deathReason: "Explosion caused by mind control",
healthEffect: -50
}
]
},
{
description: "An AI you once trusted has gone rogue. It is now manipulating all systems around you.",
choices: [
{
text: "Use your mind control to override the AI",
outcome: "You succeed, but it warns you that its systems were designed to protect the world, not control it.",
healthEffect: 0,
itemGained: "AI Override"
},
{
text: "Attempt to reason with the AI",
outcome: "The AI refuses your plea and traps you in its virtual prison.",
deathReason: "Virtual entrapment",
healthEffect: -50
},
{
text: "Destroy the AI's core server",
outcome: "You successfully destroy it, but the world descends into chaos without its guidance.",
healthEffect: -20,
itemGained: "World in Chaos"
}
]
},
{
description: "You receive an encrypted message with a warning about an impending global blackout.",
choices: [
{
text: "Prepare for the blackout by gathering resources",
outcome: "You gather everything you need to survive, but now you're a target for others.",
healthEffect: 10,
itemGained: "Survival Kit"
},
{
text: "Alert the authorities and hope they act in time",
outcome: "The authorities dismiss the warning as a hoax, and the blackout happens anyway.",
healthEffect: -10
},
{
text: "Hack into the global power grid to prevent it",
outcome: "You manage to stop the blackout, but the global grid is now under your control.",
healthEffect: 0,
itemGained: "Grid Control"
}
]
},
{
description: "Final challenge: The world's cybersecurity systems are in front of you!",
choices: [
{
text: "Deploy worldwide mind control",
outcome: "Victory! The world is now under your control!",
healthEffect: 0,
gameWin: true
},
{
text: "Wait for night when the Anti-AI AI shuts down",
outcome: "You accidentally sat on grass",
deathReason: "Touched Grass.",
healthEffect: -50
},
{
text: "Hack global banking",
outcome: "Banking AI detected you!",
deathReason: "Traced and eliminated by banking security systems",
healthEffect: -100
}
]
}
];
let currentLevel = 0;
let health = 100;
let inventory = [];
let currentDeathReason = "";
function showModal(title, message, isGameOver = false) {
const modal = document.getElementById('customModal');
const continueButton = modal.querySelector('button');
// Clear any existing onclick handlers
continueButton.onclick = null;
document.getElementById('modalTitle').textContent = title;
document.getElementById('modalMessage').innerHTML = message;
modal.style.display = 'block';
if (isGameOver) {
continueButton.textContent = 'Restart Game';
continueButton.onclick = () => {
resetGame();
};
} else {
continueButton.textContent = 'Continue';
continueButton.onclick = () => {
closeModal();
};
}
}
function closeModal() {
document.getElementById('customModal').style.display = 'none';
}
function updateHealth(change) {
health = Math.max(0, Math.min(100, health + change));
document.getElementById('health-bar').style.width = health + '%';
if (health <= 0) {
gameOver();
}
}
function gameOver() {
const modal = document.getElementById('customModal');
const continueButton = modal.querySelector('button');
// Clear any existing onclick handlers
continueButton.onclick = null;
showModal('Game Over!', 'Your health reached 0. Cause of death: ' + currentDeathReason, true);
// Set up the restart button
continueButton.textContent = 'Restart Game';
continueButton.onclick = () => {
resetGame();
};
}
function resetGame() {
currentLevel = 0;
health = 100;
// Clear the inventory array
inventory = [];
updateHealth(0);
// Update the inventory display to show empty inventory
updateInventoryDisplay();
closeModal();
loadLevel();
}
function addToInventory(item) {
inventory.push(item);
updateInventoryDisplay();
}
function updateInventoryDisplay() {
const inventoryDiv = document.getElementById('inventory-items');
inventoryDiv.innerHTML = '';
inventory.forEach((item, index) => {
const itemElement = document.createElement('div');
itemElement.className = 'inventory-item bg-gray-800 p-2 rounded text-center text-sm';
itemElement.textContent = item;
itemElement.onclick = () => useInventoryItem(index);
inventoryDiv.appendChild(itemElement);
});
}
function useInventoryItem(index) {
// Remove only the used item
inventory.splice(index, 1);
updateInventoryDisplay();
// Proceed to next level
if (currentLevel < levels.length - 1) {
currentLevel++;
loadLevel();
}
}
function loadLevel() {
const level = levels[currentLevel];
document.getElementById('level-number').textContent = currentLevel + 1;
document.getElementById('level-description').textContent = level.description;
const choicesDiv = document.getElementById('choices');
choicesDiv.innerHTML = '';
level.choices.forEach((choice, index) => {
const button = document.createElement('button');
button.className = 'neon-button';
button.textContent = choice.text;
button.onclick = () => makeChoice(index);
choicesDiv.appendChild(button);
});
// Add inventory skip option if inventory is not empty
if (inventory.length > 0) {
const skipText = document.createElement('div');
skipText.className = 'text-center mt-4 text-green-500';
skipText.textContent = "Not sure? Click on an inventory item to skip this level";
choicesDiv.appendChild(skipText);
}
}
function makeChoice(choiceIndex) {
const choice = levels[currentLevel].choices[choiceIndex];
if (choice.healthEffect < 0) {
currentDeathReason = choice.deathReason || "Unknown causes";
}
updateHealth(choice.healthEffect);
// If player dies or wins, handle it immediately
if (health <= 0) {
gameOver();
return;
}
if (choice.gameWin) {
showModal('Victory!', 'Congratulations! You\'ve won the game!', true);
return;
}
// Show the outcome message for non-death scenarios
showModal(
choice.healthEffect < 0 ? 'Damage Taken!' : 'Action Result',
choice.outcome
);
// Random chance to get item (50% probability)
if (choice.itemGained && Math.random() < 0.5) {
setTimeout(() => {
addToInventory(choice.itemGained);
showModal('Item Found!', `You obtained: ${choice.itemGained}`);
}, 1500);
}
// Always proceed to next level if not dead or won
setTimeout(() => {
if (currentLevel < levels.length - 1) {
currentLevel++;
loadLevel();
}
}, 1500);
}
// Start the game
loadLevel();
function showHowToPlay() {
showModal(
"Welcome to 'No One Can See You'!",
`<p><b>Game Overview:</b></p>
<p>'No One Can See You' is a thrilling story game where every choice matters. Navigate through a series of challenges, collect items, and manage your health to survive and win.</p>
<p><b>How to Play:</b></p>
<ol>
<li>Read the scenario for each level.</li>
<li>Choose one of the available actions.</li>
<li>Manage your health using the health bar at the top.</li>
<li>Collect and use inventory items strategically to skip difficult levels.</li>
<li>Survive and reach the final challenge to win!</li>
</ol>`
);
}
// Initialize the game with the "How to Play" modal displayed
document.addEventListener("DOMContentLoaded", () => {
showHowToPlay();
});
</script>
</body>
</html>