-
Notifications
You must be signed in to change notification settings - Fork 202
/
index.html
1323 lines (1078 loc) · 45.8 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
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="Akhilesh Yadav">
<meta name="description"
content="Alien Invasion Defense - A thrilling game where you defend Earth from alien invaders with power-ups like health boosts, shields, and speed boosts. Join the ultimate gaming experience!">
<meta name="keywords"
content="Alien Invasion Defense, alien shooter game, arcade game, defense game, space invaders, alien attack, online gaming, power-ups, gaming experience">
<meta name="robots" content="index, follow">
<meta property="og:title" content="Alien Invasion Defense - Protect Earth from Alien Invaders!">
<meta property="og:description"
content="Defend Earth against waves of alien invaders in this action-packed game. Utilize power-ups and upgrade your defenses to survive!">
<!-- <meta property="og:image" content="https://alienid.netlify.app//og-image.jpg">
<meta property="og:url" content="https://alienid.netlify.app/alien-invasion-defense"> -->
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Alien Invasion Defense - Protect Earth from Alien Invaders!">
<meta name="twitter:description"
content="Defend Earth against waves of alien invaders in this action-packed game. Use power-ups and strategies to survive!">
<!-- <meta name="twitter:image" content="https://alienid.netlify.app/twitter-image.jpg"> -->
<link rel="icon" href="favicon.png" type="image/x-icon">
<title>Alien Invasion Defense</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<link rel="stylesheet" href="Alien.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
<link rel="manifest" href="/manifest.json">
<!-- <link rel="stylesheet" href="rules.css" /> -->
<audio id="backgroundMusic" src="background-music.wav" loop></audio>
<audio id="hitSound" src="hit-sound.wav"></audio>
<audio id="gameOverSound" src="gameOver.wav"></audio>
<audio id="shieldSound" src="shield.wav"></audio>
<audio id="healthBoostSound" src="health-boost-sound.m4a"></audio>
<audio id="speedBoostSound" src="speed-boost.m4a"></audio>
<audio id="shieldSound" src="shield.m4a"></audio>
<audio id="congratsSound" src="congrats.wav"></audio>
<style>
body {
font-family: Arial, sans-serif;
}
/* Styling the progress bar */
.progress-bar-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 99999;
height: 4px;
}
#progress-bar {
border: none;
border-radius: 2rem;
height: 100%;
width: 0%;
background: linear-gradient(90deg,
cyan,
#bbdefb,
#1694db,
#5c6bc0,
#2751bd,
#283593,
#a402c4,
#F72585);
box-shadow: 0 0 5px #bbdefb, 0 0 13px #283593, 0 0 21px #F72585;
}
/* Popup Styles */
.popup {
display: none;
/* Hidden by default */
position: fixed;
/* Stay in place */
left: 0;
top: 0;
width: 100%;
/* Full width */
height: 100%;
/* Full height */
background-color: rgba(0, 0, 0, 0.5);
/* Black background with opacity */
justify-content: center;
/* Center the popup */
align-items: center;
/* Center the popup */
z-index: 1000;
/* Sit on top */
}
.popup-content {
background: linear-gradient(rgb(3 0 28 / 80%), rgb(0 2 55 / 80%)), url(your-image-url.jpg);
padding: 20px;
border-radius: 5px;
max-width: 300px;
text-align: center;
}
/* Set poll options to stack vertically */
#pollOptions {
display: flex;
flex-direction: column;
/* Stack buttons vertically */
align-items: center;
/* Center the buttons */
}
.poll-button {
display: block;
/* Change to block for full-width */
margin: 5px 0;
/* Add vertical margin */
padding: 10px 15px;
border: none;
border-radius: 5px;
background-color: #4CAF50;
/* Green */
color: white;
cursor: pointer;
transition: background-color 0.3s;
width: 100%;
/* Full width */
}
.poll-button:hover {
background-color: #45a049;
/* Darker green */
}
.poll-button.selected {
background-color: #2196F3;
/* Blue for selected */
}
/* New Vote Button Styles */
.vote-button {
display: block;
/* Change to block for full-width */
margin: 5px 0;
/* Add vertical margin */
padding: 10px 15px;
border: none;
border-radius: 5px;
background-color: #f44336;
/* Red */
color: white;
cursor: pointer;
transition: background-color 0.3s;
width: 100%;
/* Full width */
}
.vote-button:hover {
background-color: #d32f2f;
/* Darker red */
}
.uppercase {
text-transform: uppercase;
font-size: 15px;
}
#levelSelect {
background-color: transparent;
color: var(--primary-color-dark);
border: 2px solid var(--primary-color-dark);
border-radius: 5px;
padding: 10px 20px;
font-size: 14px;
outline: none;
cursor: pointer;
transition: border-color 0.3s;
}
#levelSelect:hover,
#levelSelect:focus {
border-color: #00aaff;
}
#levelSelect option {
background-color: var(--card-bg-dark);
color: var(--primary-color-dark);
}
.popup-nl {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
justify-content: center;
align-items: center;
z-index: 1009;
}
.popup-content-nl {
display: flex;
background-color: white;
border-radius: 10px;
max-width: 800px;
height: 450px;
width: 700px;
overflow: hidden;
position: relative;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}
.close1-btn-nl {
width: 20px;
cursor: pointer;
margin: 18px 10px;
position: absolute;
top: -4px;
right: 12px;
font-size: 20px;
font-weight: 800;
text-decoration: none;
}
.popup-left-nl img {
width: 100%;
height: 100%;
object-fit: cover;
}
.popup-right-nl {
padding: 20px;
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.popup-nl h1 {
font-size: 24px;
background: linear-gradient(to right, #405cac, #5ad4dc, #0058ff);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
text-align: center;
margin-bottom: 12px;
margin-top: 35px;
}
.h2-nl {
font-size: 18px;
margin-bottom: 8px;
text-align: center;
color: #333;
}
.pop_up-nl {
margin-bottom: 15px;
font-weight: bold;
background: -webkit-linear-gradient(left, #6cc7a9, #e476f9, #ff734e);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 12.7px;
}
.bold {
font-size: 13.1px;
}
input[type="email"] {
width: 93%;
padding: 10px;
margin-bottom: 16px;
border: 1px solid #000000;
border-radius: 5px;
font-size: 14px;
}
.signup-btn1-nl {
width: 100%;
text-align: center;
background: linear-gradient(to right, #1d8afb, #a0cfff, #1d8afb);
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
.signup-btn1-nl:hover {
background-color: #4682B4;
}
.no-thanks-nl {
display: block;
margin-top: 10px;
color: #888;
text-decoration: none;
margin-bottom: 15px;
}
.no-thanks-nl:hover {
color: #000000;
font-size: 14px;
}
.terms-nl {
margin-top: 15px;
font-size: 10px;
color: #888;
}
.terms-nl a {
display: inline;
}
.terms-nl a:hover {
text-decoration: underline;
}
.popup-right-nl p {
margin-top: 0;
margin-bottom: 10px;
text-align: center;
}
/* Medium screens (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
#gameCanvas {
height: 450px;
/* 4:3 aspect ratio */
width: 600px;
/* 4:3 aspect ratio */
}
}
@media (max-width: 768px){
.logoImage{
height: 65px;
}
}
/* Small screens (up to 480px) */
@media (max-width: 480px) {
#gameCanvas {
height: 240px;
/* 4:3 aspect ratio */
width: 100%;
/* 4:3 aspect ratio */
}
}
.logoImage {
height: 80px;
/* Adjust to fit the header */
width: auto;
cursor: pointer;
transition: transform 0.3s, box-shadow 0.3s, filter 0.3s;
}
.logoImage:hover {
transform: scale(1.15);
box-shadow: 0 0 15px rgba(0, 0, 255, 0.7);
/* More prominent blue glow */
filter: brightness(1.2);
background-color: rgba(0, 0, 255, 0.1);
/* Subtle blue background */
border-radius: 5px;
/* Rounded edges for a smoother look */
}
.social-icons a {
display: inline-flex;
justify-content: center;
align-items: center;
width: 2.0rem;
height: 2.0rem;
background-color: transparent;
border: 0.2rem solid #0000ffb3;
font-size: 1.1rem;
border-radius: 50%;
margin: 1.5rem 0.5rem 1.5rem 0;
transition: 0.3s ease;
color: rgba(0, 0, 255, 0.7);
text-decoration: none;
}
.social-icons a:hover {
color: black;
transform: scale(1.3) translateY(-5px);
background-color:rgba(95, 95, 219, 0.7);
box-shadow: 0 0 25px rgba(83, 83, 229, 0.7);
}
</style>
<!-- on scroll progress bar -->
<div class="progress-bar-container">
<div class="progress-bar" id="progress-bar"></div>
</div>
<div id="popup-nl" class="popup-nl">
<div class="popup-content-nl">
<div class="popup-left-nl">
<img src="popup.jpg" alt="finance">
</div>
<div class="popup-right-nl">
<a href="# " class="close1-btn-nl close-nl">×</a>
<h1>Unlock the Ultimate Gaming Experience!</h1>
<h2 class="h2-nl">Sign up to enjoy the ultimate gaming experience</h2>
<p class="pop_up-nl">Best of luck, Adventurer!</p>
<form id="emailForm-nl">
<input type="email" id="email-nl" placeholder="Enter your email" required>
<button type="submit" class="signup-btn1-nl">Subscribe</button>
</form>
<a href="#" class="no-thanks-nl close-nl">No thanks</a>
<p class="terms-nl" style="white-space: nowrap;">By subscribing to newsletters, you agree to our <br><a
href="terms&cond.html">Terms of Service</a> and <a href="privacynotice.html">Privacy Policy</a>.
</p>
</div>
</div>
</div>
<script src="popup.js"></script>
<!-- Poll Pop-up -->
<div class="popup" id="pollPopup">
<div class="popup-content">
<h2 class="uppercase">What power-up do you find most helpful?</h2>
<div id="pollOptions">
<button class="poll-button" data-value="Health Boost">Health Boost - Restores health during
gameplay.</button>
<button class="poll-button" data-value="Speed Boost">Speed Boost - Enhances your movement speed to evade
obstacles.</button>
<button class="poll-button" data-value="Shield">Shield - Offers temporary protection against enemy
attacks.</button>
<!-- Additional buttons (hidden) -->
<button class="poll-button hidden" style="display: none;" data-value="Option4">Option4</button>
<button class="poll-button hidden" style="display: none;" data-value="Option5">Option5</button>
</div>
<button id="voteButton" class="vote-button">Vote</button>
<p id="result"></p>
</div>
</div>
<script>
window.onscroll = function () {
const totalHeight = document.documentElement.scrollHeight - window.innerHeight;
const scrollPosition = window.pageYOffset;
const scrollPercentage = (scrollPosition / totalHeight) * 100;
document.getElementById(
"progress-bar"
).style.width = `${scrollPercentage}%`;
};
// Show the newsletter popup immediately on page load
function displayNewsletterPopup() {
document.getElementById('popup-nl').style.display = 'flex'; // Show newsletter
}
displayNewsletterPopup(); // Call the function
// Check if the user has already voted in this session
const hasVoted = sessionStorage.getItem('hasVoted');
// Show the poll popup after a delay, only if the user hasn't voted
function checkAndDisplayPollPopup() {
const newsletterPopup = document.getElementById('popup-nl');
if (newsletterPopup.style.display !== 'flex' && !hasVoted) {
document.getElementById('pollPopup').style.display = 'flex'; // Show poll
}
}
// Set timeout for poll display
setTimeout(checkAndDisplayPollPopup, 10000);
// Manage user selections and votes
const pollButtons = document.querySelectorAll('.poll-button[data-value]');
let selectedValue = '';
// Handle clicks on poll buttons
pollButtons.forEach(button => {
button.addEventListener('click', function () {
pollButtons.forEach(btn => btn.classList.remove('selected')); // Clear previous selections
button.classList.add('selected'); // Highlight selected button
selectedValue = button.getAttribute('data-value'); // Store selected value
});
});
// Handle voting process
document.getElementById('voteButton').addEventListener('click', function () {
if (selectedValue) {
document.getElementById('result').innerHTML = `You voted for: ${selectedValue}<br>Thank you!`; // Show result
sessionStorage.setItem('hasVoted', 'true'); // Save voting status
setTimeout(() => {
document.getElementById('pollPopup').style.display = 'none'; // Hide poll
}, 2000);
} else {
alert("Please select an option!"); // Alert if no option is selected
}
});
// Close popups function
function closePopups() {
document.getElementById('popup-nl').style.display = 'none'; // Hide newsletter popup
}
// Attach close event to close buttons
document.querySelectorAll('.close-nl').forEach(btn => {
btn.addEventListener('click', closePopups);
});
// Function to log the voting action
function logVoteAction() {
console.log("User has voted for: " + selectedValue); // Log selected value
}
// Event listener for the vote button to log action
document.getElementById('voteButton').addEventListener('click', logVoteAction);
// Function to manage button focus for accessibility
function handleFocus(event) {
event.target.style.border = '2px solid #0058ff'; // Optional highlight effect
}
// Attach focus event for accessibility improvement
pollButtons.forEach(button => {
button.addEventListener('focus', handleFocus);
});
// Function to remove focus style
function handleBlur(event) {
event.target.style.border = ''; // Remove highlight effect
}
// Attach blur event for accessibility improvement
pollButtons.forEach(button => {
button.addEventListener('blur', handleBlur);
});
// Log when the script has loaded
console.log("Poll script initialized and ready!");
</script>
</head>
<body>
<nav class="navbar">
<div class="title5">
<a href="index.html" class="home">
<img src="./assets/images/alien.png" alt="Game Logo" class="logoImage">
</a>
</div>
<!-- <div class="nav-links">
<a href="index.html">Home</a>
<a href="about-us.html">About</a>
<a href="privacy.html">Privacy</a>
<a href="Blog_page.html">Blogs</a>
<a href="Faq.html">FAQ</a>
<a href="contributors.html">Contributors</a>
<a href="testimonial.html">Testimonial</a>
<a href="auth.html">Login</a>
</div>
<div class="toggle-container aos-init aos-animate" data-aos="fade-down">
<input id="themeToggle" class="toggle" type="checkbox">
</div> -->
<div id="faqbtn">
<a href="./donation_page.html">
<button class="faq-btn">Donate</button>
</a>
</div>
<div id="faqbtn">
<a href="./share_score.html">
<button class="faq-btn">Share Score</button>
</a>
</div>
<div id="faqbtn">
<a href="./Contributors/contributor.html">
<button class="faq-btn">Contributors</button>
</a>
</div>
<div id="faqbtn">
<a href="./Login_and_Signup/index.html">
<button class="faq-btn">Signup</button>
</a>
</div>
<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox">
<div class="slider"></div>
</label>
<span id="mode-label">Light Mode</span>
</div>
</nav>
<div class="gtranslate_wrapper"></div>
<div id="gameControls" class="header">
<div class="controlGroup">
<label for="levelSelect" id="difficulty">Select Difficulty:</label>
<select id="levelSelect">
<option value="easy">Easy</option>
<option value="medium" selected>Medium</option>
<option value="hard">Hard</option>
</select>
</div>
<!-- Player name displayed here -->
<div class="controlGroup">
<span id="displayName" class="playerName"></span>
</div>
<button id="pauseBtn" style="transform: translate(0px, 0px);">Pause</button>
<div class="controlGroup">
<button id="startButton"><i class="fas fa-play" style="transform: translate(0px, 0px);" ></i> Start Game</button>
<button id="pauseButton" style="display: none"><i class="fas fa-play"></i> Game paused</button>
<button id="restartButton" style="display: none"><i class="fas fa-redo"></i> Play Again </button>
</div>
</div>
<div id="gameContainer">
<canvas id="gameCanvas"></canvas>
<div class="gameProgress">
<div id="warningMessage" class="hidden">Only 1 life remaining!</div>
<button id="restartButton" style="display: none;">Restart</button>
</div>
<div id="nextLevelMessage" class="hidden"></div>
</div>
<!-- Control buttons for mobile -->
<div class="controls" style="margin-bottom: 3vh;">
<button id="leftButton">←</button>
<button id="fireButton">🔫</button>
<button id="rightButton">→</button>
</div>
<!-- Congratulatory Popup -->
<div id="congratsPopup" style="display: none;">
<div class="popupContent">
<h2>Congratulations!</h2>
<p>You've beat your high score!</p>
<p>Your new high score is: <span id="newHighScore"></span></p>
<br>
<div id="faqbtn">
<a href="./share_score.html">
<button class="faq-btn">Share Score</button>
</a>
</div>
<br><br>
<button id="closePopupBtn">Close</button>
</div>
</div>
<header>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div class="snowflake"></div>
<div id="header">
<div class="hamburger-icon" onclick="toggleSidebar()">
<i class="fas fa-bars"></i>
</div>
<div class="sidebar" id="sidebar">
<div id="highScore">
High Score: <span id="highScoreValue"></span>
</div>
<div id="liveScore ">LIVE SCORE: <span id="score">0</span></div>
<div id="liveLife">LIVE LIFE: <span id="lives">3</span></div>
<!-- Profile Icon -->
<a href="./profile.html" class="profile-link" style="display: flex; align-items: center; text-decoration: none;">
<img id="homeProfileImage" src="https://i.postimg.cc/NFFmtc9K/xnz-Mst5-V-400x400.jpg"
alt="Profile Icon"
style="width: 50px; height: 50px; border-radius: 50%; margin-top: -57px; margin-left: 220px;">
</a>
</li>
<div id="gameInfo">
<i class="fas fa-star"></i> <span id="score">0</span> |
<i class="fas fa-level-up-alt"></i> <span id="level">1</span> |
<i class="fas fa-heart"></i> <span id="lives">3</span>
<span id="healthBoostTimer"></span>
<span id="speedBoostTimer"></span>
<span id="shieldTimer"></span>
</div>
<div id="instructions">
<div>
<div id="volumeControl">
<div id="muteControl">
<button id="muteButton" class="styled-button"
style=" display: flex; align-items: center;">
<i class="fas fa-volume-up" style="margin-right: 8px;"></i>
<p id="musicVolumeText">Music Volume</p>
</button>
</div>
<input type="range" id="volumeSlider" min="0" max="1" step="0.1" value="0.5">
</div>
</div>
<h2 class="primary-btn" id="instructionsTitle">Player Instructions</h2>
<div id="instructionsList">
<p><i class="fas fa-arrow-left"></i> Use Left/Right Arrow keys or swipe to move</p>
<p><i class="fas fa-bolt"></i> Tap or press Spacebar to shoot</p>
<p><i class="fas fa-fighter-jet"></i> Destroy red alien ships</p>
<p><i class="fas fa-shield-alt"></i> Avoid aliens reaching the bottom</p>
<p><i class="fas fa-clock"></i> Survive as long as possible!</p>
<p><i class="fas fa-plus-circle"></i> Collect Health Boost power-ups</p>
<p><i class="fas fa-tachometer-alt"></i> Collect Speed Boost power-ups</p>
<p><i class="fas fa-shield-alt"></i> Collect Shield power-ups</p>
<p><i class="fas fa-shield-alt"></i><a href="./rules.html">explore more</a></p>
</div>
</div>
<div class="visitor-counter">
<span class="icon">👁️</span> <!-- You can replace this with an eye icon image if you prefer -->
<span id="visitorCount">Visitors Count:</span>
<span class="website-counter">0</span>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
// Retrieve the saved avatar from localStorage
const savedAvatar = localStorage.getItem("selectedAvatar");
// If an avatar is saved, update the profile image
if (savedAvatar) {
const homeProfileImage = document.getElementById("homeProfileImage");
if (homeProfileImage) {
homeProfileImage.src = savedAvatar;
}
}
});
</script>
<style>
.profile-icon {
border-radius: 50%;
margin-left: 230px;
margin-top: -35px;
}
.dropdown-menu {
display: none;
position: absolute;
top: 35px;
/* Adjust based on the height of your navbar */
right: 0;
background-color: white;
color: black;
border: 1px solid #ccc;
border-radius: 4px;
z-index: 1;
}
.dropdown-menu a {
display: block;
padding: 10px 15px;
text-decoration: none;
}
.dropdown-menu a:hover {
background-color: #f1f1f1;
}
</style>
<script>
function toggleMenu() {
const menu = document.getElementById('profileMenu');
menu.style.display = menu.style.display === 'block' ? 'none' : 'block';
}
// Close the dropdown if the user clicks outside of it
window.onclick = function (event) {
if (!event.target.matches('.profile-icon img')) {
const menu = document.getElementById('profileMenu');
if (menu.style.display === 'block') {
menu.style.display = 'none';
}
}
}
</script>
<style>
.visitor-counter {
background-color: #ffffff00;
color: #1d4ed8;
/* top: auto; */
padding: 10px 20px;
border-radius: 20px;
display: inline-flex;
align-items: center;
font-family: Arial, sans-serif;
margin-left: auto;
border: 2px solid;
margin-bottom: 30px;
}
body.dark-mode .visitor-counter {
background-color: #33333300;
color: #00d0ff;
border: 2px solid
}
.visitor-counter .icon {
margin-right: 10px;
}
</style>
<script>
// Function to get the count from localStorage or initialize it
function getVisitorCount() {
return localStorage.getItem('visitorCount') || 0;
}
// Function to increment and save the count
function incrementVisitorCount() {
if (!localStorage.getItem('visitedHomePage')) {
let count = parseInt(getVisitorCount()) + 1;
localStorage.setItem('visitorCount', count);
localStorage.setItem('visitedHomePage', 'true');
return count;
}
return getVisitorCount();
}
// Function to display the count
function displayVisitorCount() {
const counterElement = document.querySelector('.website-counter');
const count = incrementVisitorCount();
counterElement.textContent = count;
}
// Call the display function when the page loads
document.addEventListener('DOMContentLoaded', displayVisitorCount);
// Function to display the count
function displayVisitorCount() {
const counterElement = document.querySelector('.website-counter');
const count = incrementVisitorCount();
counterElement.textContent = count;
}
// Call the display function when the page loads
document.addEventListener('DOMContentLoaded', displayVisitorCount);
</script>
</div>
<div id="message">
<i class="fas fa-exclamation-circle"></i> Shield Active<br /></span>
</div>
<div id="gameOver">
<i class="fas fa-exclamation-circle"></i> Game Over<br /><span id="finalScore"></span>
</div>
<!-- <div id="gameControls" class="button-container">
<div id="faqbtn">
<a href="FAQs.html">
<button class="faq-btn">FAQs</button>
</a>
</div>
<button class="feedback-button" onclick="window.location.href='feedback.html'">Feedback</button>
<button class="primary-btn" id="signupButton" window.location.href="/Login and Signup/index.html">
Signup/Register
</button>