Compare commits
No commits in common. "dd08ea599df1d676b68b773a1b6ad44356bf1b64" and "1f57d8ec153f511d772871716acef4222000fd0a" have entirely different histories.
dd08ea599d
...
1f57d8ec15
@ -124,6 +124,7 @@ function startTimer() {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- FUNGSI END SCREEN (YANG DI-UPDATE) ---
|
||||||
function showEndScreen(isWin) {
|
function showEndScreen(isWin) {
|
||||||
clearInterval(countdown);
|
clearInterval(countdown);
|
||||||
bgMusic.pause();
|
bgMusic.pause();
|
||||||
@ -137,11 +138,42 @@ function showEndScreen(isWin) {
|
|||||||
let moveBonus = isWin ? Math.max(0, 200 - moves * 10) : 0;
|
let moveBonus = isWin ? Math.max(0, 200 - moves * 10) : 0;
|
||||||
let total = baseScore + timeBonus + moveBonus;
|
let total = baseScore + timeBonus + moveBonus;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
document.getElementById("baseScoreEnd").textContent = baseScore;
|
document.getElementById("baseScoreEnd").textContent = baseScore;
|
||||||
document.getElementById("timeBonusEnd").textContent = "+" + timeBonus;
|
document.getElementById("timeBonusEnd").textContent = "+" + timeBonus;
|
||||||
document.getElementById("moveBonusEnd").textContent = "+" + moveBonus;
|
document.getElementById("moveBonusEnd").textContent = "+" + moveBonus;
|
||||||
document.getElementById("totalScoreEnd").textContent = total;
|
document.getElementById("totalScoreEnd").textContent = total;
|
||||||
document.getElementById("endScreen").style.display = "flex";
|
document.getElementById("endScreen").style.display = "flex";
|
||||||
|
=======
|
||||||
|
let baseScore = score;
|
||||||
|
let timeBonus = time * 5;
|
||||||
|
let moveBonus = Math.max(0, 200 - moves * 10);
|
||||||
|
let total = baseScore + timeBonus + moveBonus;
|
||||||
|
|
||||||
|
document.getElementById("baseScoreEnd").textContent = baseScore;
|
||||||
|
document.getElementById("timeBonusEnd").textContent = "+" + (isWin ? timeBonus : 0);
|
||||||
|
document.getElementById("moveBonusEnd").textContent = "+" + (isWin ? moveBonus : 0);
|
||||||
|
document.getElementById("totalScoreEnd").textContent = isWin ? total : baseScore;
|
||||||
|
|
||||||
|
// --- KIRIM SCORE KE DATABASE ---
|
||||||
|
if (isWin) {
|
||||||
|
// Bungkus data score
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('score', total);
|
||||||
|
|
||||||
|
// Kirim ke score.php (tanpa reload halaman)
|
||||||
|
fetch('score.php', {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(result => console.log("Status Simpan Score: " + result))
|
||||||
|
.catch(error => console.error('Error:', error));
|
||||||
|
}
|
||||||
|
// ------------------------------
|
||||||
|
|
||||||
|
document.getElementById("endScreen").style.display = "flex";
|
||||||
|
>>>>>>> 43b6ab58ae77611b561af08efaf30f5d542b0ebc
|
||||||
}
|
}
|
||||||
|
|
||||||
function flipCard(card) {
|
function flipCard(card) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user