-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
789 lines (692 loc) · 22.4 KB
/
Copy pathscript.js
File metadata and controls
789 lines (692 loc) · 22.4 KB
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
const bees = [
"Basic",
"Bomber",
"Brave",
"Bumble",
"Cool",
"Hasty",
"Looker",
"Rad",
"Rascal",
"Stubborn",
"Bubble",
"Bucko",
"Commander",
"Demo",
"Exhausted",
"Fire",
"Frosty",
"Honey",
"Rage",
"Riley",
"Shocked",
"Baby",
"Carpenter",
"Demon",
"Diamond",
"Lion",
"Music",
"Ninja",
"Shy",
"Buoyant",
"Fuzzy",
"Precise",
"Spicy",
"Tadpole",
"Vector",
"Bear",
"Cobalt",
"Crimson",
"Digital",
"Festive",
"Gummy",
"Photon",
"Puppy",
"Tabby",
"Vicious",
"Windy",
];
function getDailyBee() {
const start = new Date(2024, 0, 1);
const now = new Date();
const diff = Math.floor((now - start) / (1000 * 60 * 60 * 24));
return bees[diff % bees.length].toLowerCase();
}
let answer = getDailyBee(),
attempts = 6;
const maxAttempts = attempts;
// Stat Guess Mode variables
let isStatGuessMode = false;
const statModeToggle = document.getElementById("stat-mode-toggle");
let statGrid = null;
let statGuessActive = false;
// Initialize stat guess mode toggle
statModeToggle.checked = localStorage.getItem("statGuessMode") === "true";
isStatGuessMode = statModeToggle.checked;
setupGame();
// Add event listener for stat mode toggle
statModeToggle.addEventListener("change", () => {
isStatGuessMode = statModeToggle.checked;
localStorage.setItem("statGuessMode", isStatGuessMode);
setupGame();
});
// Function to set up the game based on mode
function setupGame() {
const guessGrid = document.getElementById("guess-grid");
const guessInput = document.getElementById("guess-input");
const guessButton = document.getElementById("guess-button");
// Clear existing content
guessGrid.innerHTML = "";
document.getElementById("remaining-attempts").innerText = `Attempts left before you're out of royal jelly: ${attempts}`;
if (isStatGuessMode) {
// Set up stat guess mode UI
guessGrid.classList.add("stat-grid");
createStatGrid();
updateStatDisplay();
document.querySelector("h3").innerText = "Guess the bee based on its stats in six attempts";
} else {
// Set up regular mode UI
guessGrid.classList.remove("stat-grid");
document.querySelector("h3").innerText = "Guess the bee in six attempts or less";
}
// Reset input and button state
guessInput.value = "";
guessButton.disabled = true;
}
// Create the stat grid for Stat Guess Mode
function createStatGrid() {
const guessGrid = document.getElementById("guess-grid");
// Create headers for stats
const headerRow = document.createElement("div");
headerRow.className = "stat-row header-row";
const headers = ["Guess", "Color", "Rarity", "Attack", "Energy", "Speed"];
headers.forEach(header => {
const headerCell = document.createElement("div");
headerCell.className = "stat-cell stat-header";
headerCell.innerText = header;
headerRow.appendChild(headerCell);
});
guessGrid.appendChild(headerRow);
// Create empty rows for guesses
for (let i = 0; i < maxAttempts; i++) {
const row = document.createElement("div");
row.className = "stat-row";
row.id = `stat-row-${i}`;
for (let j = 0; j < headers.length; j++) {
const cell = document.createElement("div");
cell.className = "stat-cell";
cell.id = `cell-${i}-${j}`;
row.appendChild(cell);
}
guessGrid.appendChild(row);
}
}
// Update the stat display when in Stat Guess Mode
function updateStatDisplay() {
if (!isStatGuessMode) return;
const answerStats = beeStats[answer];
// Don't show anything initially, stats will be revealed as player makes guesses
}
// Check a guess in Stat Guess Mode
function checkStatGuess(guess) {
const guessLower = guess.toLowerCase();
const guessStats = beeStats[guessLower];
const answerStats = beeStats[answer];
const currentAttempt = maxAttempts - attempts;
const row = document.getElementById(`stat-row-${currentAttempt}`);
const cells = row.querySelectorAll(".stat-cell");
// Set the bee name in the first cell
cells[0].innerText = guessStats.name;
// Color
cells[1].innerText = guessStats.color;
if (guessStats.color === answerStats.color) {
cells[1].classList.add("correct");
} else {
cells[1].classList.add("absent");
}
// Rarity
cells[2].innerText = guessStats.rarity;
if (guessStats.rarity === answerStats.rarity) {
cells[2].classList.add("correct");
} else {
cells[2].classList.add("absent");
}
// Attack
cells[3].innerText = guessStats.attack;
if (guessStats.attack === answerStats.attack) {
cells[3].classList.add("correct");
} else {
if (guessStats.attack < answerStats.attack) {
cells[3].classList.add("present");
cells[3].innerHTML += ' <span class="arrow">↑</span>';
} else {
cells[3].classList.add("present");
cells[3].innerHTML += ' <span class="arrow">↓</span>';
}
}
// Energy
cells[4].innerText = guessStats.energy;
if (guessStats.energy === answerStats.energy) {
cells[4].classList.add("correct");
} else {
if (guessStats.energy < answerStats.energy) {
cells[4].classList.add("present");
cells[4].innerHTML += ' <span class="arrow">↑</span>';
} else {
cells[4].classList.add("present");
cells[4].innerHTML += ' <span class="arrow">↓</span>';
}
}
// Speed
cells[5].innerText = guessStats.speed;
if (guessStats.speed === answerStats.speed) {
cells[5].classList.add("correct");
} else {
if (guessStats.speed < answerStats.speed) {
cells[5].classList.add("present");
cells[5].innerHTML += ' <span class="arrow">↑</span>';
} else {
cells[5].classList.add("present");
cells[5].innerHTML += ' <span class="arrow">↓</span>';
}
}
}
// Original event listeners and functions
document.getElementById("guess-input").addEventListener("input", () => {
const guess = document.getElementById("guess-input").value.toLowerCase();
const submitButton = document.getElementById("guess-button");
submitButton.disabled = !(
guess.length > 0 && bees.map((b) => b.toLowerCase()).includes(guess)
);
});
document.getElementById("guess-input").addEventListener("keyup", (event) => {
if (
event.key === "Enter" &&
!document.getElementById("guess-button").disabled
) {
submitGuess();
}
});
document.getElementById("guess-button").addEventListener("click", submitGuess);
document.getElementById("reset-button").addEventListener("click", () => {
if (
confirm(
"Are you sure you want to reset all data? This action cannot bee undone."
)
) {
resetAllData();
}
});
// Updated to handle Stat Guess mode
function submitGuess() {
if (attempts <= 0 || document.getElementById("guess-button").disabled) {
return;
}
const guess = document.getElementById("guess-input").value.toLowerCase();
if (!bees.map((b) => b.toLowerCase()).includes(guess)) {
alert("Invalid bee name. Please enter a valid bee or buzz off!");
return;
}
attempts--;
if (isStatGuessMode) {
// Handle stat guess mode
checkStatGuess(guess);
document.getElementById("remaining-attempts").innerText = `Attempts left before you're out of royal jelly: ${attempts}`;
// Check if the player won
if (guess === answer) {
setTimeout(() => {
soundEnabled && playSound("correct");
alert("Un-bee-lievable! You guessed the bee!");
const attemptsUsed = maxAttempts - attempts;
updateStats(true, attemptsUsed);
checkPerfectGame(attemptsUsed);
checkAchievements(true, attemptsUsed);
endGame(true);
showBeeImage();
}, 500);
} else if (attempts === 0) {
setTimeout(() => {
soundEnabled && playSound("incorrect");
alert(`Game Over! The bee was ${answer}. Better luck nectar time!`);
consecutiveWins = 0;
localStorage.setItem("consecutiveWins", consecutiveWins);
updateStats(false, maxAttempts);
checkAchievements(false, maxAttempts);
endGame(false);
showBeeImage();
}, 500);
}
} else {
// Handle original mode
checkGuess(guess);
}
document.getElementById("guess-input").value = "";
document.getElementById("guess-input").focus();
}
// Original checkGuess function
function checkGuess(guess) {
const guessRow = document.createElement("div");
guessRow.className = "guess-row";
const guessArray = guess.split("");
const answerArray = answer.split("");
guessArray.forEach((letter, index) => {
const guessBox = document.createElement("div");
guessBox.className = "guess-box";
guessBox.innerText = letter;
guessRow.appendChild(guessBox);
setTimeout(() => {
playSound("flip");
if (answerArray[index] === letter) {
guessBox.classList.add("correct");
playSound("letter_correct");
} else if (answerArray.includes(letter)) {
guessBox.classList.add("present");
playSound("letter_present");
} else {
guessBox.classList.add("absent");
}
}, index * 300);
});
document.getElementById("guess-grid").appendChild(guessRow);
document.getElementById(
"remaining-attempts"
).innerText = `Attempts left: ${attempts}`;
setTimeout(() => {
if (guess === answer) {
console.log("Correct guess!");
soundEnabled && playSound("correct");
alert("Un-bee-lievable! You guessed the bee!");
const attemptsUsed = maxAttempts - attempts;
console.log(`Attempts used: ${attemptsUsed}`);
updateStats(true, attemptsUsed);
checkPerfectGame(attemptsUsed);
checkAchievements(true, attemptsUsed);
endGame(true);
showBeeImage();
} else if (attempts === 0) {
soundEnabled && playSound("incorrect");
alert(`Game Over! The bee was ${answer}. Better luck nectar time!`);
consecutiveWins = 0;
localStorage.setItem("consecutiveWins", consecutiveWins);
updateStats(false, maxAttempts);
checkAchievements(false, maxAttempts);
endGame(false);
showBeeImage();
}
}, guessArray.length * 300 + 150);
}
function checkPerfectGame(attemptsUsed) {
console.log(`Checking perfect game. Attempts used: ${attemptsUsed}`);
console.log(`Perfect game unlocked: ${achievements.perfectGame.unlocked}`);
if (attemptsUsed === 1 && !achievements.perfectGame.unlocked) {
console.log("Unlocking perfect game achievement!");
achievements.perfectGame.unlocked = true;
showModal("Achievement Unlocked: Perfect Game!");
saveAchievements();
} else {
console.log(`Not a perfect game. Attempts used: ${attemptsUsed}`);
}
logAchievements();
}
function endGame(isWin) {
document.getElementById("guess-button").disabled = true;
document.getElementById("guess-input").disabled = true;
checkAchievements(isWin, maxAttempts - attempts + 1);
}
function showBeeImage() {
const beeImage = document.getElementById("bee-image");
beeImage.style.display = "block";
beeImage.src = `bee/${answer.replace(/ /g, "_")}.png`;
}
function updateCountdown() {
const now = new Date();
const nextMidnight = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() + 1
);
const timeRemaining = nextMidnight - now;
const hours = Math.floor(
(timeRemaining % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
const minutes = Math.floor((timeRemaining % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeRemaining % (1000 * 60)) / 1000);
document.getElementById(
"timer"
).innerText = `${hours}h ${minutes}m ${seconds}s`;
}
setInterval(updateCountdown, 1000);
updateCountdown();
// Initialize or load stats from localStorage
let stats = JSON.parse(localStorage.getItem("stats")) || {
gamesPlayed: 0,
gamesWon: 0,
currentStreak: 0,
maxStreak: 0,
guessDistribution: [0, 0, 0, 0, 0, 0],
};
// Update stats after each game
function updateStats(isWin, attempts) {
stats.gamesPlayed++;
if (isWin) {
stats.gamesWon++;
stats.currentStreak++;
stats.maxStreak = Math.max(stats.maxStreak, stats.currentStreak);
stats.guessDistribution[attempts - 1]++;
} else { // Player lost
stats.currentStreak = 0;
// Add this line to record the loss in the guess distribution
// 'attempts' will be maxAttempts when isWin is false, as per the calling context in submitGuess
stats.guessDistribution[attempts - 1]++;
}
localStorage.setItem("stats", JSON.stringify(stats));
displayStats();
}
const soundToggle = document.getElementById("sound-toggle");
let soundEnabled = localStorage.getItem("soundEnabled") !== "false";
soundToggle.checked = soundEnabled;
soundToggle.addEventListener("change", () => {
soundEnabled = soundToggle.checked;
localStorage.setItem("soundEnabled", soundEnabled);
});
function playSound(soundName) {
if (soundEnabled) {
const sound = new Audio(`sound/${soundName}.mp3`);
sound.play().catch((error) => console.error("Error playing sound:", error));
}
}
let achievements = JSON.parse(localStorage.getItem("achievements")) || {
firstWin: {
name: "First Win",
description: "Win your first game",
unlocked: false,
icon: "badge/firstWin.png",
},
threeInARow: {
name: "Hat Trick",
description: "Win three games in a row",
unlocked: false,
icon: "badge/threeInARow.png",
},
perfectGame: {
name: "Perfect Game",
description: "Win in just one attempt",
unlocked: false,
icon: "badge/perfectGame.png",
},
fiveWins: {
name: "High Five",
description: "Win 5 games in total",
unlocked: false,
icon: "badge/fiveWins.png",
},
tenWins: {
name: "Bee-lliant!",
description: "Win 10 games in total",
unlocked: false,
icon: "badge/tenWins.png",
},
lastSecond: {
name: "Close Call",
description: "Win on the last attempt",
unlocked: false,
icon: "badge/lastSecond.png",
},
quickWin: {
name: "Speed Demon",
description: "Win within 30 seconds",
unlocked: false,
icon: "badge/quickWin.png",
},
persistentPlayer: {
name: "Persistent",
description: "Play for 5 days in a row",
unlocked: false,
icon: "badge/persistentPlayer.png",
},
superStar: {
name: "SuperStar",
description: "Unlock all achievements",
unlocked: false,
icon: "badge/superStar.png",
},
};
// Function to save achievements
function saveAchievements() {
localStorage.setItem("achievements", JSON.stringify(achievements));
}
document.getElementById("achievements-button").addEventListener("click", () => {
let achievementsContent =
"<h2>Hive Achievements</h2><div class='achievements-grid'>";
for (let key in achievements) {
const achievement = achievements[key];
achievementsContent += `
<div class="achievement-item ${
achievement.unlocked ? "unlocked" : "locked"
}">
<div class="achievement-icon">
<img src="${achievement.icon}" alt="${
achievement.name
} icon">
</div>
<div class="achievement-info">
<h3>${achievement.name}</h3>
<p>${achievement.description}</p>
</div>
</div>
`;
}
achievementsContent += "</div>";
showModal(achievementsContent);
});
// Add this variable at the top of your script, with other global variables
let consecutiveWins = parseInt(localStorage.getItem("consecutiveWins")) || 0;
// Modify the checkAchievements function
function checkAchievements(isWin, attemptsUsed) {
if (isWin) {
consecutiveWins++;
localStorage.setItem("consecutiveWins", consecutiveWins);
if (!achievements.firstWin.unlocked) {
unlockAchievement("firstWin");
}
if (!achievements.threeInARow.unlocked && consecutiveWins === 3) {
unlockAchievement("threeInARow");
}
if (!achievements.fiveWins.unlocked && stats.gamesWon >= 5) {
unlockAchievement("fiveWins");
}
if (!achievements.tenWins.unlocked && stats.gamesWon >= 10) {
unlockAchievement("tenWins");
}
if (!achievements.lastSecond.unlocked && attemptsUsed === maxAttempts) {
unlockAchievement("lastSecond");
}
const gameTime = (new Date() - gameStartTime) / 1000;
if (!achievements.quickWin.unlocked && gameTime <= 30) {
unlockAchievement("quickWin");
}
} else {
consecutiveWins = 0;
localStorage.setItem("consecutiveWins", consecutiveWins);
}
checkPersistentPlayer();
checkSuperStar(); // Check if all achievements are unlocked
localStorage.setItem("stats", JSON.stringify(stats));
}
function unlockAchievement(achievementKey) {
achievements[achievementKey].unlocked = true;
showModal(`Achievement Unlocked: ${achievements[achievementKey].name}!`);
saveAchievements();
}
function checkPersistentPlayer() {
const lastPlayedDates = JSON.parse(localStorage.getItem("lastPlayedDates")) || [];
const currentDay = new Date().toDateString();
// Only add today if it's not already in the array
if (!lastPlayedDates.includes(currentDay)) {
// Add today's date
lastPlayedDates.push(currentDay);
// Sort dates chronologically (oldest to newest)
lastPlayedDates.sort((a, b) => new Date(a) - new Date(b));
// Keep only the most recent 5 days
while (lastPlayedDates.length > 5) {
lastPlayedDates.shift();
}
localStorage.setItem("lastPlayedDates", JSON.stringify(lastPlayedDates));
// If we have 5 dates, check if they're consecutive
if (lastPlayedDates.length === 5 && !achievements.persistentPlayer.unlocked) {
// Convert string dates to Date objects
const dateObjects = lastPlayedDates.map(d => new Date(d));
// Check if dates are consecutive
let consecutive = true;
for (let i = 1; i < dateObjects.length; i++) {
const prevDate = new Date(dateObjects[i-1]);
const currDate = new Date(dateObjects[i]);
// Set hours to noon to avoid timezone/DST issues
prevDate.setHours(12, 0, 0, 0);
currDate.setHours(12, 0, 0, 0);
// Calculate difference in days
const diffTime = currDate - prevDate;
const diffDays = Math.round(diffTime / (1000 * 60 * 60 * 24));
// If the difference is not 1 day, dates aren't consecutive
if (diffDays !== 1) {
consecutive = false;
break;
}
}
if (consecutive) {
unlockAchievement("persistentPlayer");
}
}
}
}
let gameStartTime;
function startGame() {
gameStartTime = new Date();
}
// Function to load achievements at the start of the game
function loadAchievements() {
const savedAchievements = JSON.parse(localStorage.getItem("achievements"));
if (savedAchievements) {
for (let key in savedAchievements) {
if (achievements.hasOwnProperty(key)) {
achievements[key].unlocked = savedAchievements[key].unlocked;
}
}
}
}
// Call this function when the game starts
window.onload = function () {
loadAchievements();
startGame();
};
function showModal(content) {
const modal = document.getElementById("modal");
const modalText = document.getElementById("modal-text");
modalText.innerHTML = content;
modal.style.display = "block";
const closeBtn = modal.querySelector(".close");
closeBtn.onclick = function () {
modal.style.display = "none";
};
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
}
};
}
document.getElementById("tutorial-button").addEventListener("click", () => {
showModal(tutorialContent);
});
const tutorialContent = `
<h2>How to Play Beedle</h2>
<ol>
<li>You have 6 attempts to guess the correct bee from Bee Swarm Simulator.</li>
<li>After each guess, the color of the tiles will change to show how close your guess was:</li>
<ul>
<li>Green: Correct letter in the correct position (Sweet as honey!)</li>
<li>Yellow: Correct letter but in the wrong position (Almost there, busy bee!)</li>
<li>Gray: Letter is not in the word (Buzz off, wrong letter!)</li>
</ul>
<li>Keep guessing until you find the correct bee or run out of attempts!</li>
</ol>
<p>Remember, bee positive and have fun!</p>
`;
document
.getElementById("show-stats-button")
.addEventListener("click", displayStats);
// Display game statistics
function displayStats() {
const statsContent = `
<h2>Hive Statistics</h2>
<div class="stats-container">
<div class="stat-item">
<div class="stat-number">${stats.gamesPlayed}</div>
<div>Games Pollinated</div>
</div>
<div class="stat-item">
<div class="stat-number">${
Math.round((stats.gamesWon / stats.gamesPlayed) * 100) || 0
}%</div>
<div>Honey Success Rate</div>
</div>
<div class="stat-item">
<div class="stat-number">${stats.currentStreak}</div>
<div>Current Swarm</div>
</div>
<div class="stat-item">
<div class="stat-number">${stats.maxStreak}</div>
<div>Longest Honey Streak</div>
</div>
</div>
<h3>Guess Distribution (Honey Levels)</h3>
<div class="guess-distribution">
${stats.guessDistribution
.map(
(count, index) => `
<div class="guess-bar">
<div class="guess-label">${index + 1}</div>
<div class="guess-count" style="width: ${
(count / Math.max(...stats.guessDistribution)) * 100
}%">${count}</div>
</div>
`
)
.join("")}
</div>
`;
showModal(statsContent);
}
function resetAllData() {
// Clear all localStorage items
localStorage.clear();
location.reload();
}
document.addEventListener('DOMContentLoaded', function() {
// Removing duplicate navbar code as it's already handled in index.html
});
// Prevent context menu on mobile devices
document.addEventListener('contextmenu', function(event) {
event.preventDefault();
return false;
});
// Keep these functions
function logAchievements() {
console.log("Current Achievements Status:");
for (let key in achievements) {
console.log(`${achievements[key].name}: ${achievements[key].unlocked ? "Unlocked" : "Locked"}`);
}
}
// Add function to check if all achievements are unlocked
function checkSuperStar() {
if (achievements.superStar.unlocked) return; // Already unlocked
let allUnlocked = true;
for (let key in achievements) {
if (key !== 'superStar' && !achievements[key].unlocked) {
allUnlocked = false;
break;
}
}
if (allUnlocked) {
unlockAchievement("superStar");
}
}