update music background
This commit is contained in:
parent
4e8855532e
commit
255a35e4ac
@ -20,6 +20,30 @@ body {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* OVERLAY COUNTDOWN */
|
||||||
|
#countdown-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0; left: 0; width: 100%; height: 100%;
|
||||||
|
background: rgba(0,0,0,0.85);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
z-index: 1000;
|
||||||
|
color: white;
|
||||||
|
font-size: 150px;
|
||||||
|
font-weight: 800;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pulse-anim {
|
||||||
|
animation: pulse 1s ease-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0% { transform: scale(1); opacity: 1; }
|
||||||
|
100% { transform: scale(2); opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
.topbar {
|
.topbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@ -67,7 +91,7 @@ body {
|
|||||||
grid-template-rows: repeat(3, 1fr);
|
grid-template-rows: repeat(3, 1fr);
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
@ -200,38 +224,25 @@ body {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gameboard {
|
|
||||||
flex: 1;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(4, 1fr);
|
|
||||||
gap: 16px;
|
|
||||||
padding: 25px 40px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
place-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
width: 100%;
|
|
||||||
aspect-ratio: 4 / 3;
|
|
||||||
perspective: 1000px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.play-again { background: #b700ff; color: white; }
|
.play-again { background: #b700ff; color: white; }
|
||||||
.leaderboard { background: gold; }
|
.leaderboard { background: gold; }
|
||||||
.back-menu { background: #444; color: white; }
|
.back-menu { background: #444; color: white; }
|
||||||
|
|
||||||
@keyframes fadeIn {
|
.music-control {
|
||||||
from { opacity:0; transform: scale(0.8); }
|
position: fixed;
|
||||||
to { opacity:1; transform: scale(1); }
|
bottom: 20px;
|
||||||
}
|
right: 20px;
|
||||||
|
z-index: 100;
|
||||||
@media (max-width: 700px) {
|
background: white;
|
||||||
.gameboard {
|
width: 45px;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
height: 45px;
|
||||||
padding: 12px;
|
border-radius: 50%;
|
||||||
gap: 10px;
|
display: flex;
|
||||||
}
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 0 4px 10px rgba(0,0,0,0.3);
|
||||||
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
@ -241,11 +252,22 @@ body {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div id="countdown-overlay"></div>
|
||||||
|
|
||||||
|
<audio id="bgMusic" loop src="music_background.mp3"></audio>
|
||||||
|
<audio id="sfxClick" src="music-click.mp3"></audio>
|
||||||
|
<audio id="sfxMatch" src="music-correct.mp3"></audio>
|
||||||
|
<audio id="sfxWrong" src="music-incorrect.mp3"></audio>
|
||||||
|
<audio id="sfxCountdown" src="music-countdown.mp3"></audio>
|
||||||
|
<audio id="sfxWin" src="music-win.mp3"></audio>
|
||||||
|
<audio id="sfxLose" src="music-lose.mp3"></audio>
|
||||||
|
|
||||||
|
<div class="music-control" id="toggleMusic">🔇</div>
|
||||||
|
|
||||||
<header class="topbar">
|
<header class="topbar">
|
||||||
<button class="back-btn" onclick="window.location.href='mainboard.html'">←</button>
|
<button class="back-btn" onclick="window.location.href='mainboard.html'">←</button>
|
||||||
<div class="right-info">
|
<div class="right-info">
|
||||||
@ -256,16 +278,16 @@ body {
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="game-board" class="gameboard"></div>
|
<div id="game-board" class="gameboard"></div>
|
||||||
|
|
||||||
<div id="endScreen" class="end-screen">
|
<div id="endScreen" class="end-screen">
|
||||||
<div class="end-box">
|
<div class="end-box">
|
||||||
<div class="end-title">🎉 Selamat!</div>
|
<div id="endTitle" class="end-title">🎉 Selamat!</div>
|
||||||
<p>Anda berhasil menyelesaikan permainan!</p>
|
<p id="endMsg">Anda berhasil menyelesaikan permainan!</p>
|
||||||
|
|
||||||
<div class="score-row"><span>Skor Base:</span> <span id="baseScoreEnd">0</span></div>
|
<div class="score-row"><span>Skor Base:</span> <span id="baseScoreEnd">0</span></div>
|
||||||
<div class="score-row"><span>Time Bonus:</span> <span id="timeBonusEnd">0</span></div>
|
<div class="score-row"><span>Time Bonus:</span> <span id="timeBonusEnd">0</span></div>
|
||||||
<div class="score-row"><span>Move Bonus:</span> <span id="moveBonusEnd">0</span></div>
|
<div class="score-row"><span>Move Bonus:</span> <span id="moveBonusEnd">0</span></div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="score-row" style="font-weight:700;">
|
<div class="score-row" style="font-weight:700;">
|
||||||
<span>Total Skor:</span>
|
<span>Total Skor:</span>
|
||||||
<span id="totalScoreEnd">0</span>
|
<span id="totalScoreEnd">0</span>
|
||||||
@ -274,18 +296,58 @@ body {
|
|||||||
<button class="end-btn play-again" onclick="startGame()">🔁 Main Lagi</button>
|
<button class="end-btn play-again" onclick="startGame()">🔁 Main Lagi</button>
|
||||||
<button class="end-btn leaderboard">🏆 Lihat Leaderboard</button>
|
<button class="end-btn leaderboard">🏆 Lihat Leaderboard</button>
|
||||||
<button class="end-btn back-menu" onclick="window.location.href='mainboard.html'">⬅ Kembali</button>
|
<button class="end-btn back-menu" onclick="window.location.href='mainboard.html'">⬅ Kembali</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// --- KONFIGURASI AUDIO & DOM ---
|
||||||
|
const bgMusic = document.getElementById("bgMusic");
|
||||||
|
const sfxClick = document.getElementById("sfxClick");
|
||||||
|
const sfxMatch = document.getElementById("sfxMatch");
|
||||||
|
const sfxWrong = document.getElementById("sfxWrong");
|
||||||
|
const sfxCountdown = document.getElementById("sfxCountdown");
|
||||||
|
const sfxWin = document.getElementById("sfxWin");
|
||||||
|
const sfxLose = document.getElementById("sfxLose");
|
||||||
|
const toggleBtn = document.getElementById("toggleMusic");
|
||||||
|
const overlay = document.getElementById("countdown-overlay");
|
||||||
|
|
||||||
|
let musicMuted = true;
|
||||||
|
|
||||||
|
// AUTO-PLAY PADA INTERAKSI PERTAMA
|
||||||
|
function initAudio() {
|
||||||
|
if(musicMuted) {
|
||||||
|
bgMusic.play().catch(() => {});
|
||||||
|
bgMusic.volume = 0.5;
|
||||||
|
toggleBtn.textContent = "🔊";
|
||||||
|
musicMuted = false;
|
||||||
|
document.removeEventListener('click', initAudio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.addEventListener('click', initAudio);
|
||||||
|
|
||||||
|
toggleBtn.onclick = (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (musicMuted) {
|
||||||
|
bgMusic.play();
|
||||||
|
toggleBtn.textContent = "🔊";
|
||||||
|
} else {
|
||||||
|
bgMusic.pause();
|
||||||
|
toggleBtn.textContent = "🔇";
|
||||||
|
}
|
||||||
|
musicMuted = !musicMuted;
|
||||||
|
};
|
||||||
|
|
||||||
|
function playSFX(audio) {
|
||||||
|
if(!musicMuted) {
|
||||||
|
audio.currentTime = 0;
|
||||||
|
audio.play().catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- LOGIKA GAME ASLI ---
|
||||||
const images = [
|
const images = [
|
||||||
"images/fruit1.png",
|
"images/fruit1.png", "images/fruit2.png", "images/fruit3.png",
|
||||||
"images/fruit2.png",
|
"images/fruit4.png", "images/fruit5.png", "images/fruit6.png",
|
||||||
"images/fruit3.png",
|
|
||||||
"images/fruit4.png",
|
|
||||||
"images/fruit5.png",
|
|
||||||
"images/fruit6.png",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
let cards = [...images, ...images];
|
let cards = [...images, ...images];
|
||||||
@ -299,21 +361,6 @@ let combo = 1;
|
|||||||
let lastMatchTime = 0;
|
let lastMatchTime = 0;
|
||||||
let pendingMatch = false;
|
let pendingMatch = false;
|
||||||
|
|
||||||
function showComboPopup(targetCard, combo, bonus) {
|
|
||||||
const popup = document.createElement("div");
|
|
||||||
popup.className = "combo-popup";
|
|
||||||
popup.innerHTML = `
|
|
||||||
COMBO X${combo}<br>
|
|
||||||
<span style="font-size:14px; opacity:0.9;">+${bonus} Bonus</span>
|
|
||||||
`;
|
|
||||||
const rect = targetCard.getBoundingClientRect();
|
|
||||||
popup.style.left = rect.left + rect.width / 2 + "px";
|
|
||||||
popup.style.top = rect.top + "px";
|
|
||||||
popup.style.position = "fixed";
|
|
||||||
document.body.appendChild(popup);
|
|
||||||
setTimeout(() => popup.remove(), 1500);
|
|
||||||
}
|
|
||||||
|
|
||||||
function shuffleArray(array) {
|
function shuffleArray(array) {
|
||||||
for (let i = array.length - 1; i > 0; i--) {
|
for (let i = array.length - 1; i > 0; i--) {
|
||||||
const j = Math.floor(Math.random() * (i + 1));
|
const j = Math.floor(Math.random() * (i + 1));
|
||||||
@ -322,27 +369,56 @@ function shuffleArray(array) {
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function runCountdown(callback) {
|
||||||
|
let count = 3;
|
||||||
|
overlay.style.display = "flex";
|
||||||
|
overlay.innerHTML = `<span class="pulse-anim">${count}</span>`;
|
||||||
|
playSFX(sfxCountdown);
|
||||||
|
|
||||||
|
let cdTimer = setInterval(() => {
|
||||||
|
count--;
|
||||||
|
if (count > 0) {
|
||||||
|
overlay.innerHTML = `<span class="pulse-anim">${count}</span>`;
|
||||||
|
playSFX(sfxCountdown);
|
||||||
|
} else if (count === 0) {
|
||||||
|
overlay.innerHTML = `<span class="pulse-anim">GO!</span>`;
|
||||||
|
} else {
|
||||||
|
clearInterval(cdTimer);
|
||||||
|
overlay.style.display = "none";
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
function startTimer() {
|
function startTimer() {
|
||||||
timerStarted = true;
|
timerStarted = true;
|
||||||
countdown = setInterval(() => {
|
countdown = setInterval(() => {
|
||||||
document.getElementById("timer").textContent = --time;
|
document.getElementById("timer").textContent = --time;
|
||||||
if (time <= 0) {
|
if (time <= 0) {
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
showEndScreen();
|
showEndScreen(false); // Kalah
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEndScreen() {
|
function showEndScreen(isWin) {
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
|
bgMusic.pause();
|
||||||
|
|
||||||
|
if(isWin) playSFX(sfxWin); else playSFX(sfxLose);
|
||||||
|
|
||||||
|
document.getElementById("endTitle").textContent = isWin ? "🎉 Selamat!" : "⏰ Waktu Habis!";
|
||||||
|
document.getElementById("endMsg").textContent = isWin ? "Anda berhasil menyelesaikan permainan!" : "Coba lagi lain kali!";
|
||||||
|
|
||||||
let baseScore = score;
|
let baseScore = score;
|
||||||
let timeBonus = time * 5;
|
let timeBonus = time * 5;
|
||||||
let moveBonus = Math.max(0, 200 - moves * 10);
|
let moveBonus = Math.max(0, 200 - moves * 10);
|
||||||
let total = baseScore + timeBonus + moveBonus;
|
let total = baseScore + timeBonus + moveBonus;
|
||||||
|
|
||||||
document.getElementById("baseScoreEnd").textContent = baseScore;
|
document.getElementById("baseScoreEnd").textContent = baseScore;
|
||||||
document.getElementById("timeBonusEnd").textContent = "+" + timeBonus;
|
document.getElementById("timeBonusEnd").textContent = "+" + (isWin ? timeBonus : 0);
|
||||||
document.getElementById("moveBonusEnd").textContent = "+" + moveBonus;
|
document.getElementById("moveBonusEnd").textContent = "+" + (isWin ? moveBonus : 0);
|
||||||
document.getElementById("totalScoreEnd").textContent = total;
|
document.getElementById("totalScoreEnd").textContent = isWin ? total : baseScore;
|
||||||
document.getElementById("endScreen").style.display = "flex";
|
document.getElementById("endScreen").style.display = "flex";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,52 +426,39 @@ function flipCard(card) {
|
|||||||
if (!timerStarted) startTimer();
|
if (!timerStarted) startTimer();
|
||||||
if (flipped.length === 2 || card.classList.contains("matched") || card.classList.contains("flipped"))
|
if (flipped.length === 2 || card.classList.contains("matched") || card.classList.contains("flipped"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
playSFX(sfxClick);
|
||||||
card.classList.add("flipped");
|
card.classList.add("flipped");
|
||||||
flipped.push(card);
|
flipped.push(card);
|
||||||
|
|
||||||
if (flipped.length === 2) {
|
if (flipped.length === 2) {
|
||||||
moves++;
|
moves++;
|
||||||
document.getElementById("moves").textContent = moves;
|
document.getElementById("moves").textContent = moves;
|
||||||
|
|
||||||
let img1 = flipped[0].querySelector(".back img").src;
|
let img1 = flipped[0].querySelector(".back img").src;
|
||||||
let img2 = flipped[1].querySelector(".back img").src;
|
let img2 = flipped[1].querySelector(".back img").src;
|
||||||
|
|
||||||
if (img1 === img2) {
|
if (img1 === img2) {
|
||||||
|
playSFX(sfxMatch);
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
if (!pendingMatch) { pendingMatch = true; combo = 1; }
|
||||||
if (!pendingMatch) {
|
else {
|
||||||
pendingMatch = true;
|
|
||||||
combo = 1;
|
|
||||||
} else {
|
|
||||||
if (now - lastMatchTime <= 3000) {
|
if (now - lastMatchTime <= 3000) {
|
||||||
combo++;
|
combo++;
|
||||||
let comboBonus = 10 * combo;
|
score += (10 * combo);
|
||||||
score += comboBonus;
|
|
||||||
document.getElementById("score").textContent = score;
|
document.getElementById("score").textContent = score;
|
||||||
|
} else { combo = 1; }
|
||||||
showComboPopup(flipped[0], combo, comboBonus);
|
|
||||||
} else {
|
|
||||||
combo = 1;
|
|
||||||
pendingMatch = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lastMatchTime = now;
|
lastMatchTime = now;
|
||||||
flipped.forEach(c => c.classList.add("matched"));
|
flipped.forEach(c => c.classList.add("matched"));
|
||||||
|
|
||||||
score += 50;
|
score += 50;
|
||||||
document.getElementById("score").textContent = score;
|
document.getElementById("score").textContent = score;
|
||||||
|
|
||||||
time += 5;
|
time += 5;
|
||||||
document.getElementById("timer").textContent = time;
|
|
||||||
|
|
||||||
flipped = [];
|
flipped = [];
|
||||||
|
|
||||||
if (document.querySelectorAll(".matched").length === cards.length) {
|
if (document.querySelectorAll(".matched").length === cards.length) {
|
||||||
setTimeout(showEndScreen, 600);
|
setTimeout(() => showEndScreen(true), 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
playSFX(sfxWrong);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
flipped.forEach(c => c.classList.remove("flipped"));
|
flipped.forEach(c => c.classList.remove("flipped"));
|
||||||
flipped = [];
|
flipped = [];
|
||||||
@ -406,42 +469,28 @@ function flipCard(card) {
|
|||||||
|
|
||||||
function startGame() {
|
function startGame() {
|
||||||
document.getElementById("endScreen").style.display = "none";
|
document.getElementById("endScreen").style.display = "none";
|
||||||
|
|
||||||
const board = document.getElementById("game-board");
|
const board = document.getElementById("game-board");
|
||||||
board.innerHTML = "";
|
board.innerHTML = "";
|
||||||
const shuffledCards = shuffleArray([...cards]);
|
|
||||||
|
runCountdown(() => {
|
||||||
shuffledCards.forEach(image => {
|
if(!musicMuted) bgMusic.play();
|
||||||
const card = document.createElement("div");
|
const shuffledCards = shuffleArray([...cards]);
|
||||||
card.className = "card";
|
shuffledCards.forEach(image => {
|
||||||
card.innerHTML = `
|
const card = document.createElement("div");
|
||||||
<div class="inner">
|
card.className = "card";
|
||||||
<div class="front">?</div>
|
card.innerHTML = `<div class="inner"><div class="front">?</div><div class="back"><img src="${image}"></div></div>`;
|
||||||
<div class="back"><img src="${image}"></div>
|
card.onclick = () => flipCard(card);
|
||||||
</div>
|
board.appendChild(card);
|
||||||
`;
|
});
|
||||||
card.onclick = () => flipCard(card);
|
time = 60; moves = 0; score = 0; combo = 1;
|
||||||
board.appendChild(card);
|
timerStarted = false;
|
||||||
|
document.getElementById("timer").textContent = time;
|
||||||
|
document.getElementById("moves").textContent = moves;
|
||||||
|
document.getElementById("score").textContent = score;
|
||||||
});
|
});
|
||||||
|
|
||||||
time = 60;
|
|
||||||
moves = 0;
|
|
||||||
score = 0;
|
|
||||||
|
|
||||||
combo = 1;
|
|
||||||
lastMatchTime = 0;
|
|
||||||
pendingMatch = false;
|
|
||||||
|
|
||||||
flipped = [];
|
|
||||||
timerStarted = false;
|
|
||||||
|
|
||||||
document.getElementById("timer").textContent = time;
|
|
||||||
document.getElementById("moves").textContent = moves;
|
|
||||||
document.getElementById("score").textContent = score;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
startGame();
|
startGame();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -99,7 +99,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ================================
|
/* ================================
|
||||||
🎀 BUTTONS
|
🎀 BUTTONS
|
||||||
================================== */
|
================================== */
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
@ -130,7 +130,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ================================
|
/* ================================
|
||||||
📝 TITLE
|
📝 TITLE
|
||||||
================================== */
|
================================== */
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
@ -149,7 +149,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ================================
|
/* ================================
|
||||||
🎮 STAGE SELECTION GRID
|
🎮 STAGE SELECTION GRID
|
||||||
================================== */
|
================================== */
|
||||||
|
|
||||||
.stage-grid {
|
.stage-grid {
|
||||||
@ -212,14 +212,47 @@ body {
|
|||||||
100% { transform: translateX(0); }
|
100% { transform: translateX(0); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* STYLE TAMBAHAN UNTUK TOMBOL SPEAKER */
|
||||||
|
.music-container {
|
||||||
|
position: fixed;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.music-btn {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
||||||
|
font-size: 24px;
|
||||||
|
transition: 0.3s;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.music-btn:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<div class="music-container">
|
||||||
|
<button id="musicBtn" class="music-btn">🔇</button>
|
||||||
|
</div>
|
||||||
|
<audio id="bgMusic" loop>
|
||||||
|
<source src="music_background.mp3" type="audio/mpeg">
|
||||||
|
</audio>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<!-- animasi -->
|
|
||||||
<img src="images/fruit1.png" class="fruit f1">
|
<img src="images/fruit1.png" class="fruit f1">
|
||||||
<img src="images/fruit2.png" class="fruit f2">
|
<img src="images/fruit2.png" class="fruit f2">
|
||||||
<img src="images/fruit3.png" class="fruit f3">
|
<img src="images/fruit3.png" class="fruit f3">
|
||||||
@ -231,7 +264,6 @@ body {
|
|||||||
<img src="images/fruit9.png" class="fruit f9">
|
<img src="images/fruit9.png" class="fruit f9">
|
||||||
<img src="images/fruit10.png" class="fruit f10">
|
<img src="images/fruit10.png" class="fruit f10">
|
||||||
|
|
||||||
<!-- HEADER -->
|
|
||||||
<header class="header glass">
|
<header class="header glass">
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<div>
|
<div>
|
||||||
@ -251,7 +283,6 @@ body {
|
|||||||
<p>Pilih tingkat kesulitan untuk memulai permainan</p>
|
<p>Pilih tingkat kesulitan untuk memulai permainan</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- STAGE SELECTION -->
|
|
||||||
<div class="stage-grid">
|
<div class="stage-grid">
|
||||||
<button class="stage-btn easy" onclick="selectStage('easy')">
|
<button class="stage-btn easy" onclick="selectStage('easy')">
|
||||||
<span class="icon">😊</span>
|
<span class="icon">😊</span>
|
||||||
@ -275,6 +306,23 @@ body {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// LOGIKA MUSIK
|
||||||
|
const musicBtn = document.getElementById('musicBtn');
|
||||||
|
const bgMusic = document.getElementById('bgMusic');
|
||||||
|
let isMusicPlaying = false;
|
||||||
|
|
||||||
|
musicBtn.addEventListener('click', () => {
|
||||||
|
if (isMusicPlaying) {
|
||||||
|
bgMusic.pause();
|
||||||
|
musicBtn.innerText = '🔇';
|
||||||
|
} else {
|
||||||
|
bgMusic.play();
|
||||||
|
musicBtn.innerText = '🔊';
|
||||||
|
}
|
||||||
|
isMusicPlaying = !isMusicPlaying;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Kodingan asli kamu tetap di bawah ini
|
||||||
function selectStage(stage) {
|
function selectStage(stage) {
|
||||||
if (stage === "easy") {
|
if (stage === "easy") {
|
||||||
window.location.href = "gameboard-easy.html";
|
window.location.href = "gameboard-easy.html";
|
||||||
@ -293,4 +341,4 @@ document.getElementById("logoutBtn").addEventListener("click", () => {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
BIN
music/music-click.mp3
Normal file
BIN
music/music-click.mp3
Normal file
Binary file not shown.
BIN
music/music-correct.mp3
Normal file
BIN
music/music-correct.mp3
Normal file
Binary file not shown.
BIN
music/music-countdown.mp3
Normal file
BIN
music/music-countdown.mp3
Normal file
Binary file not shown.
BIN
music/music-incorrect.mp3
Normal file
BIN
music/music-incorrect.mp3
Normal file
Binary file not shown.
BIN
music/music-lose.mp3
Normal file
BIN
music/music-lose.mp3
Normal file
Binary file not shown.
BIN
music/music-win.mp3
Normal file
BIN
music/music-win.mp3
Normal file
Binary file not shown.
BIN
music/music_background.mp3
Normal file
BIN
music/music_background.mp3
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user