Compare commits
2 Commits
1f57d8ec15
...
dd08ea599d
| Author | SHA1 | Date | |
|---|---|---|---|
| dd08ea599d | |||
| 894e52473b |
@ -124,7 +124,6 @@ function startTimer() {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// --- FUNGSI END SCREEN (YANG DI-UPDATE) ---
|
||||
function showEndScreen(isWin) {
|
||||
clearInterval(countdown);
|
||||
bgMusic.pause();
|
||||
@ -138,42 +137,11 @@ function showEndScreen(isWin) {
|
||||
let moveBonus = isWin ? Math.max(0, 200 - moves * 10) : 0;
|
||||
let total = baseScore + timeBonus + moveBonus;
|
||||
|
||||
<<<<<<< HEAD
|
||||
document.getElementById("baseScoreEnd").textContent = baseScore;
|
||||
document.getElementById("timeBonusEnd").textContent = "+" + timeBonus;
|
||||
document.getElementById("moveBonusEnd").textContent = "+" + moveBonus;
|
||||
document.getElementById("totalScoreEnd").textContent = total;
|
||||
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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user