update : credit + edit container

This commit is contained in:
Yustina 2025-12-16 01:51:22 +07:00 committed by Nathan
parent 77a89683d4
commit 3e654af257
7 changed files with 427 additions and 259 deletions

163
assets/mainboard.css Normal file
View File

@ -0,0 +1,163 @@
/* ================================
1. BODY (KUNCI ANTI-SCROLL)
================================== */
body {
margin: 0;
font-family: Poppins, Arial, sans-serif;
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
height: 100vh; /* Kunci tinggi layar */
overflow: hidden; /* Hilangkan scrollbar */
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
/* ================================
2. CONTAINER (UKURAN TETAP / STAY)
================================== */
.container {
width: 90%;
max-width: 800px;
background: rgba(255,255,255,0.7);
backdrop-filter: blur(15px);
padding: 25px 35px;
border-radius: 28px;
box-shadow: 0 15px 35px rgba(0,0,0,0.2);
z-index: 10;
display: flex;
flex-direction: column;
animation: fadeIn 0.6s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
/* Header & Tombol */
.header {
background: rgba(255,255,255,0.65);
padding: 15px 22px;
border-radius: 20px;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 12px;
cursor: pointer;
font-size: 14px;
font-weight: bold;
transition: 0.25s;
}
.blue { background: linear-gradient(to right, #4facfe, #00f2fe); color: white; margin-right: 5px; }
.gold { background: linear-gradient(to right, gold, orange); color: white; margin-right: 5px; }
.gray { background: #444; color: white; }
.btn:hover { transform: scale(1.05); }
/* Judul & Grid */
.title { text-align: center; margin-bottom: 20px; }
.title h1 {
font-size: 38px;
margin: 0;
background: linear-gradient(purple, hotpink);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.stage-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
}
.stage-btn {
background: white;
padding: 20px;
border-radius: 20px;
text-align: center;
cursor: pointer;
border: none;
}
.icon { font-size: 40px; display: block; }
/* ================================
3. BACKGROUND FRUITS
================================== */
.fruit {
position: absolute;
width: 90px;
opacity: 0.8;
animation: floatFruit 6s infinite ease-in-out;
pointer-events: none;
z-index: 1;
}
.f1 { top: 10%; left: 5%; }
.f2 { bottom: 10%; right: 5%; }
.f3 { top: 20%; right: 10%; }
.f4 { bottom: 20%; left: 15%; }
@keyframes floatFruit {
0%, 100% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-20px) rotate(5deg); }
}
/* ================================
4. OVERLAY CREDITS (ANIMASI JALAN)
================================== */
.credits-overlay {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.95);
backdrop-filter: blur(10px);
display: none; /* Muncul lewat JS */
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 9999;
color: white;
}
.credits-box {
height: 60%;
width: 80%;
max-width: 500px;
overflow: hidden;
position: relative;
border-top: 1px solid rgba(255,255,255,0.2);
border-bottom: 1px solid rgba(255,255,255,0.2);
}
.credits-scroll {
position: absolute;
width: 100%;
text-align: center;
animation: scrollAnimation 15s linear infinite;
}
@keyframes scrollAnimation {
0% { top: 100%; }
100% { top: -120%; }
}
.credits-title { color: #ff419b; font-size: 2.5rem; margin-bottom: 30px; }
.credits-section { margin-bottom: 30px; }
.close-credits {
margin-top: 30px;
padding: 12px 40px;
background: white;
color: black;
border: none;
border-radius: 10px;
font-weight: bold;
cursor: pointer;
}
/* Musik */
.music-container { position: fixed; top: 20px; right: 20px; z-index: 1000; }
.music-btn { width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer; font-size: 24px; background: white; }

32
assets/mainboard.js Normal file
View File

@ -0,0 +1,32 @@
// LOGIKA MUSIK
const musicBtn = document.getElementById('musicBtn');
const bgMusic = document.getElementById('bgMusic');
let isMusicPlaying = false;
musicBtn.addEventListener('click', () => {
isMusicPlaying ? bgMusic.pause() : bgMusic.play();
musicBtn.innerText = isMusicPlaying ? '🔇' : '🔊';
isMusicPlaying = !isMusicPlaying;
});
// NAVIGATION
function selectStage(stage) {
window.location.href = "gameboard-" + stage + ".html";
}
document.getElementById("leaderboardBtn").addEventListener("click", () => {
window.location.href = "Leaderboard.html";
});
document.getElementById("logoutBtn").addEventListener("click", () => {
alert("Logout berhasil!");
});
// OVERLAY CREDITS
function openCredits() {
document.getElementById('creditsOverlay').style.display = 'flex';
}
function closeCredits() {
document.getElementById('creditsOverlay').style.display = 'none';
}

View File

@ -28,19 +28,51 @@ function toggleAuth(mode) {
setTimeout(setHeight, 50); setTimeout(setHeight, 50);
} }
// 3. DETEKSI ERROR DARI PHP // ==========================================
// 3. DETEKSI PESAN DARI PHP (UPDATED)
// ==========================================
window.addEventListener("DOMContentLoaded", function() { window.addEventListener("DOMContentLoaded", function() {
setHeight(); // Set tinggi awal setHeight(); // Set tinggi awal
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const errorStatus = urlParams.get('error');
// 1. Tangkap Parameter
const loginError = urlParams.get('error'); // Untuk Login Gagal
const registerError = urlParams.get('register_error'); // Untuk Register Gagal
const successStatus = urlParams.get('success'); // Untuk Register Sukses
if (errorStatus === 'gagal') { // 2. Logic Login Error
if (loginError === 'gagal') {
const errorBox = document.getElementById("loginError"); const errorBox = document.getElementById("loginError");
errorBox.innerText = "Username atau Password salah!"; errorBox.innerHTML = "<p>Username atau Password salah!</p>";
errorBox.style.display = "block";
setHeight();
}
// 3. Logic Register Error (PENTING: Pindah tab ke Register dulu)
if (registerError) {
// Otomatis pindah ke mode register supaya user liat errornya
toggleAuth('register');
const errorBox = document.getElementById("regError");
errorBox.innerHTML = "<p>" + registerError + "</p>";
errorBox.style.display = "block"; errorBox.style.display = "block";
// Tunggu transisi sebentar, lalu set tinggi lagi
setTimeout(setHeight, 100);
}
// 4. Logic Register Sukses
if (successStatus === 'register') {
const errorBox = document.getElementById("loginError");
// Pakai warna hijau biar kelihatan sukses
errorBox.innerHTML = "<p style='color: #2ecc71;'>Register Berhasil! Silakan Login.</p>";
errorBox.style.display = "block";
setHeight(); setHeight();
}
// 5. Bersihkan URL (Supaya kalau di-refresh errornya hilang)
if (loginError || registerError || successStatus) {
window.history.replaceState(null, null, window.location.pathname); window.history.replaceState(null, null, window.location.pathname);
} }
}); });

View File

@ -13,6 +13,7 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
/* ===================================================== /* =====================================================
REGISTER REGISTER
===================================================== */ ===================================================== */
// Ini akan mendeteksi <input type="hidden" name="btn-register"> dari HTML
if (isset($_POST['btn-register'])) { if (isset($_POST['btn-register'])) {
$username = trim($_POST['username']); $username = trim($_POST['username']);
@ -22,8 +23,7 @@ if (isset($_POST['btn-register'])) {
// --- VALIDASI DASAR --- // --- VALIDASI DASAR ---
if (!$username || !$email || !$password || !$confirm) { if (empty($username) || empty($email) || empty($password) || empty($confirm)) {
// Balik ke index dengan pesan error
header("Location: index.php?register_error=Data tidak boleh kosong"); header("Location: index.php?register_error=Data tidak boleh kosong");
exit; exit;
} }
@ -51,7 +51,6 @@ if (isset($_POST['btn-register'])) {
$cek->store_result(); $cek->store_result();
if ($cek->num_rows > 0) { if ($cek->num_rows > 0) {
// INI YANG SEBELUMNYA MATI, SEKARANG REDIRECT:
header("Location: index.php?register_error=Username atau Email sudah terdaftar!"); header("Location: index.php?register_error=Username atau Email sudah terdaftar!");
exit; exit;
} }
@ -64,9 +63,8 @@ if (isset($_POST['btn-register'])) {
$insert->bind_param("sss", $username, $email, $hash); $insert->bind_param("sss", $username, $email, $hash);
if ($insert->execute()) { if ($insert->execute()) {
// Register Berhasil -> Arahkan ke Login (atau mainboard) // PERUBAHAN DISINI: Tambahkan ?success=register agar JS menampilkan pesan hijau
// Kita kosongkan error agar masuk ke state normal header("Location: index.php?success=register");
header("Location: index.php");
exit; exit;
} else { } else {
header("Location: index.php?register_error=Gagal mendaftar, coba lagi nanti."); header("Location: index.php?register_error=Gagal mendaftar, coba lagi nanti.");
@ -94,7 +92,6 @@ if (isset($_POST['btn-login'])) {
// Cek Password // Cek Password
if (!$user || !password_verify($password, $user['password'])) { if (!$user || !password_verify($password, $user['password'])) {
// Redirect dengan parameter 'error=gagal' agar ditangkap JS Login
header("Location: index.php?error=gagal"); header("Location: index.php?error=gagal");
exit; exit;
} }

View File

@ -8,9 +8,8 @@
<style> <style>
html, body { html, body {
margin: 0; margin: 0;
height: 100%; height: 100vh; /* Gunakan vh agar benar-benar setinggi layar */
overflow-x: hidden; overflow: hidden; /* Kunci agar tidak bisa scroll sama sekali */
overflow-y: auto;
font-family: "Poppins", sans-serif; font-family: "Poppins", sans-serif;
} }
@ -18,6 +17,7 @@ body {
background: linear-gradient(135deg, #8929ff 30%, #ff419b 100%); background: linear-gradient(135deg, #8929ff 30%, #ff419b 100%);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh; /* Memastikan body memenuhi layar */
} }
/* OVERLAY COUNTDOWN */ /* OVERLAY COUNTDOWN */
@ -84,6 +84,7 @@ body {
.icon { font-size: 18px; } .icon { font-size: 18px; }
/* Update pada gameboard */
.gameboard { .gameboard {
flex: 1; flex: 1;
display: grid; display: grid;
@ -91,14 +92,17 @@ 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;
overflow: hidden; /* Mencegah container ini meluap */
height: 0; /* Trik agar flex-grow (flex:1) menghitung tinggi dengan benar */
} }
/* Update pada card agar ukurannya proporsional */
.card { .card {
width: 100%; width: 100%;
height: 100%; height: 100%;
perspective: 1000px; perspective: 1000px;
max-height: 160px; /* Hapus max-height agar kartu mengikuti tinggi grid yang tersedia */
cursor: pointer; cursor: pointer;
} }

View File

@ -35,7 +35,9 @@
</p> </p>
</form> </form>
<form id="registerForm" action="auth.php" method="POST"> <form id="registerForm" action="auth.php" method="POST">
<input type="hidden" name="btn-register" value="true">
<h2>Buat Akun Baru </h2> <h2>Buat Akun Baru </h2>
<p class="subtitle">Daftar petualangan baru</p> <p class="subtitle">Daftar petualangan baru</p>
@ -52,6 +54,7 @@
<label>Konfirmasi Password</label> <label>Konfirmasi Password</label>
<input type="password" id="regConfirm" name="confirm_password" placeholder="Ulangi Password" required> <input type="password" id="regConfirm" name="confirm_password" placeholder="Ulangi Password" required>
<button type="submit" class="btn-submit" name="btn-register">Daftar Sekarang</button> <button type="submit" class="btn-submit" name="btn-register">Daftar Sekarang</button>
<p class="switch-text"> <p class="switch-text">

View File

@ -7,53 +7,34 @@
<style> <style>
/* ================================ /* ================================
BODY & BACKGROUND STYLES 1. BODY (KUNCI ANTI-SCROLL)
================================== */ ================================== */
body { body {
margin: 0; margin: 0;
font-family: Poppins, Arial, sans-serif; font-family: Poppins, Arial, sans-serif;
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd); background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
min-height: 100vh; height: 100vh; /* Kunci tinggi layar */
overflow-x: hidden; overflow: hidden; /* Hilangkan scrollbar */
overflow-y: auto;
display: flex; display: flex;
justify-content: center; justify-content: center;
padding: 50px 0; align-items: center;
position: relative; position: relative;
} }
/* Glow Background Floating */
.bg-circle {
position: absolute;
border-radius: 50%;
filter: blur(70px);
opacity: 0.7;
animation: float 6s infinite ease-in-out;
}
.circle-one { top: 10%; left: 5%; width: 250px; height: 250px; background: rgba(255,255,255,0.25); }
.circle-two { bottom: 15%; right: 8%; width: 300px; height: 300px; background: rgba(255,192,203,0.35); animation-delay: 1s; }
.circle-three { top: 45%; left: 60%; width: 260px; height: 260px; background: rgba(180,120,255,0.35); animation-delay: 2s; }
@keyframes float {
0%,100% { transform: translateY(0); }
50% { transform: translateY(-25px); }
}
/* ================================ /* ================================
CONTAINER CARD 2. CONTAINER (UKURAN TETAP / STAY)
================================== */ ================================== */
.container { .container {
width: 750px; width: 90%;
max-width: 800px;
background: rgba(255,255,255,0.7); background: rgba(255,255,255,0.7);
backdrop-filter: blur(15px); backdrop-filter: blur(15px);
padding: 45px; padding: 25px 35px;
border-radius: 28px; border-radius: 28px;
box-shadow: 0 15px 35px rgba(0,0,0,0.2); box-shadow: 0 15px 35px rgba(0,0,0,0.2);
z-index: 10; z-index: 10;
display: flex;
flex-direction: column;
animation: fadeIn 0.6s ease-out; animation: fadeIn 0.6s ease-out;
} }
@ -62,283 +43,239 @@ body {
to { opacity: 1; transform: translateY(0); } to { opacity: 1; transform: translateY(0); }
} }
/* ================================ /* Header & Tombol */
HEADER PROFILE
================================== */
.header { .header {
background: rgba(255,255,255,0.65); background: rgba(255,255,255,0.65);
backdrop-filter: blur(15px); padding: 15px 22px;
padding: 22px;
border-radius: 20px; border-radius: 20px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
box-shadow: 0 10px 30px rgba(0,0,0,0.08); margin-bottom: 20px;
margin-bottom: 35px;
} }
.user-info {
display: flex;
align-items: center;
gap: 15px;
}
.user-icon {
width: 60px;
height: 60px;
border-radius: 50%;
background: linear-gradient(135deg, purple, hotpink);
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 25px;
font-weight: bold;
box-shadow: 0 5px 18px rgba(0,0,0,0.22);
}
/* ================================
🎀 BUTTONS
================================== */
.btn { .btn {
padding: 12px 25px; padding: 10px 20px;
border: none; border: none;
border-radius: 14px; border-radius: 12px;
cursor: pointer; cursor: pointer;
font-size: 16px; font-size: 14px;
transition: .25s;
}
.gold {
background: linear-gradient(to right, gold, orange);
color: white;
}
.gold:hover {
transform: scale(1.07);
box-shadow: 0 4px 12px rgba(255,165,0,0.4);
}
.gray {
background: #444;
color: white;
}
.gray:hover {
background: #222;
transform: scale(1.05);
}
/* ================================
📝 TITLE
================================== */
.title {
text-align: center;
margin: 40px 0;
}
.title h1 {
font-size: 46px;
background: linear-gradient(purple, hotpink);
background-clip: text; /* Standar */
-webkit-background-clip: text;
color: transparent;
font-weight: bold; font-weight: bold;
text-shadow: 0 0 10px rgba(255,255,255,0.2); transition: 0.25s;
} }
.blue { background: linear-gradient(to right, #4facfe, #00f2fe); color: white; margin-right: 5px; }
.gold { background: linear-gradient(to right, gold, orange); color: white; margin-right: 5px; }
.gray { background: #444; color: white; }
.btn:hover { transform: scale(1.05); }
/* ================================ /* Judul & Grid */
🎮 STAGE SELECTION GRID .title { text-align: center; margin-bottom: 20px; }
================================== */ .title h1 {
font-size: 38px;
margin: 0;
background: linear-gradient(purple, hotpink);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.stage-grid { .stage-grid {
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 30px; gap: 20px;
} }
.stage-btn { .stage-btn {
background: rgba(255,255,255,0.65); background: white;
backdrop-filter: blur(10px); padding: 20px;
padding: 35px; border-radius: 20px;
border-radius: 25px;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
transition: .25s ease;
box-shadow: 0 12px 25px rgba(0,0,0,0.12);
}
.stage-btn:hover {
transform: scale(1.08);
background: rgba(255,255,255,0.88);
box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}
.icon {
font-size: 48px;
display: block;
margin-bottom: 12px;
}
.fruit {
position: absolute;
width: 95px;
opacity: .85;
animation: float 6s infinite ease-in-out, drift 15s infinite linear;
pointer-events: none;
}
.f1 { top: 8%; left: 10%; animation-delay: .3s; }
.f2 { top: 65%; right: 12%; animation-delay: .7s; }
.f3 { top: 22%; right: 55%; animation-delay: 1.1s; }
.f4 { bottom: 15%; left: 28%; animation-delay: .9s; }
.f5 { bottom: 10%; right: 30%; animation-delay: 1.4s; }
.f6 { top: 40%; left: 50%; animation-delay: .5s; }
.f7 { bottom: 30%; left: 15%; animation-delay: 1.2s; }
.f8 { top: 75%; right: 40%; animation-delay: .8s; }
.f9 { top: 50%; left: 80%; animation-delay: 1s; }
.f10 { bottom: 20%; right: 5%; animation-delay: 1.3s; }
@keyframes float {
0% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-20px) rotate(6deg); }
100% { transform: translateY(0) rotate(0deg); }
}
@keyframes drift {
0% { transform: translateX(0); }
50% { transform: translateX(15px); }
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; border: none;
} }
.icon { font-size: 40px; display: block; }
.music-btn:hover { /* ================================
transform: scale(1.1); 3. BACKGROUND FRUITS
================================== */
.fruit {
position: absolute;
width: 90px;
opacity: 0.8;
animation: floatFruit 6s infinite ease-in-out;
pointer-events: none;
z-index: 1;
}
.f1 { top: 10%; left: 5%; }
.f2 { bottom: 10%; right: 5%; }
.f3 { top: 20%; right: 10%; }
.f4 { bottom: 20%; left: 15%; }
@keyframes floatFruit {
0%, 100% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-20px) rotate(5deg); }
} }
</style> /* ================================
4. OVERLAY CREDITS (ANIMASI JALAN)
================================== */
.credits-overlay {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.95);
backdrop-filter: blur(10px);
display: none; /* Muncul lewat JS */
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 9999;
color: white;
}
.credits-box {
height: 60%;
width: 80%;
max-width: 500px;
overflow: hidden;
position: relative;
border-top: 1px solid rgba(255,255,255,0.2);
border-bottom: 1px solid rgba(255,255,255,0.2);
}
.credits-scroll {
position: absolute;
width: 100%;
text-align: center;
animation: scrollAnimation 15s linear infinite;
}
@keyframes scrollAnimation {
0% { top: 100%; }
100% { top: -120%; }
}
.credits-title { color: #ff419b; font-size: 2.5rem; margin-bottom: 30px; }
.credits-section { margin-bottom: 30px; }
.close-credits {
margin-top: 30px;
padding: 12px 40px;
background: white;
color: black;
border: none;
border-radius: 10px;
font-weight: bold;
cursor: pointer;
}
/* Musik */
.music-container { position: fixed; top: 20px; right: 20px; z-index: 1000; }
.music-btn { width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer; font-size: 24px; background: white; }
</style>
</head> </head>
<body> <body>
<img src="images/fruit1.png" class="fruit f1">
<img src="images/fruit2.png" class="fruit f2">
<img src="images/fruit3.png" class="fruit f3">
<img src="images/fruit4.png" class="fruit f4">
<div class="music-container"> <div class="music-container">
<button id="musicBtn" class="music-btn">🔇</button> <button id="musicBtn" class="music-btn">🔇</button>
</div> </div>
<audio id="bgMusic" loop> <audio id="bgMusic" loop src="music/music_background.mp3"></audio>
<source src="music/music_background.mp3" type="audio/mpeg">
</audio>
<div class="container"> <div class="container">
<header class="header">
<img src="images/fruit1.png" class="fruit f1">
<img src="images/fruit2.png" class="fruit f2">
<img src="images/fruit3.png" class="fruit f3">
<img src="images/fruit4.png" class="fruit f4">
<img src="images/fruit5.png" class="fruit f5">
<img src="images/fruit6.png" class="fruit f6">
<img src="images/fruit7.png" class="fruit f7">
<img src="images/fruit8.png" class="fruit f8">
<img src="images/fruit9.png" class="fruit f9">
<img src="images/fruit10.png" class="fruit f10">
<header class="header glass">
<div class="user-info"> <div class="user-info">
<div> <h2 style="margin:0">Player</h2>
<h2 id="username">Player</h2> <p style="margin:0">🎮 Player</p>
<p id="role">🎮 Player</p>
</div>
</div> </div>
<div class="actions"> <div class="actions">
<button id="leaderboardBtn" class="btn gold" onclick="window.location.href='leaderboard.html'">🏆 Leaderboard</button> <button class="btn blue" onclick="openCredits()"> Credit</button>
<button id="leaderboardBtn" class="btn gold">🏆 Leaderboard</button>
<button id="logoutBtn" class="btn gray">🚪 Logout</button> <button id="logoutBtn" class="btn gray">🚪 Logout</button>
</div> </div>
</header> </header>
<div class="title"> <div class="title">
<h1 class="title">Memory Flip Card Game</h1> <h1>Memory Flip Card</h1>
<p>Pilih tingkat kesulitan untuk memulai permainan</p> <p>Pilih tingkat kesulitan untuk memulai permainan</p>
</div> </div>
<div class="stage-grid"> <div class="stage-grid">
<button class="stage-btn easy" onclick="selectStage('easy')"> <button class="stage-btn" onclick="selectStage('easy')">
<span class="icon">😊</span> <span class="icon">😊</span>
<h3>Easy Mode</h3> <h3>Easy Mode</h3>
<p>Grid 3x4 (12 kartu)</p>
</button> </button>
<button class="stage-btn" onclick="selectStage('medium')">
<button class="stage-btn medium" onclick="selectStage('medium')">
<span class="icon">🤔</span> <span class="icon">🤔</span>
<h3>Medium Mode</h3> <h3>Medium Mode</h3>
<p>Grid 4x4 (16 kartu)</p>
</button> </button>
<button class="stage-btn" onclick="selectStage('hard')">
<button class="stage-btn hard" onclick="selectStage('hard')">
<span class="icon">😤</span> <span class="icon">😤</span>
<h3>Hard Mode</h3> <h3>Hard Mode</h3>
<p>Grid 4x5 (20 kartu)</p>
</button> </button>
</div> </div>
</div> </div>
<script> <div id="creditsOverlay" class="credits-overlay">
// LOGIKA MUSIK <div class="credits-box">
const musicBtn = document.getElementById('musicBtn'); <div class="credits-scroll">
const bgMusic = document.getElementById('bgMusic'); <h2 class="credits-title">CREDITS</h2>
let isMusicPlaying = false; <div class="credits-section">
<p><strong>KELOMPOK 2</strong></p>
<p>Evelyn Adi Gloria - 5803025026</p>
<p>Nathan Handoko S - 5803025001</p>
<p>Yustina Rizky S.P - 5803025041</p>
</div>
<div class="credits-section">
<p><strong>PROJECT UAS</strong></p>
<p>MEMORI FLIP CARD</p>
</div>
<div class="credits-section">
<p><strong>SPECIAL THANKS</strong></p>
<p>Bu Devi dan Pak Andrew<br>dan teman-teman informatika</p>
</div>
<p>© 2025 UKWMS</p>
</div>
</div>
<button class="close-credits" onclick="closeCredits()">TUTUP</button>
</div>
musicBtn.addEventListener('click', () => { <script>
if (isMusicPlaying) { // LOGIKA MUSIK
bgMusic.pause(); const musicBtn = document.getElementById('musicBtn');
musicBtn.innerText = '🔇'; const bgMusic = document.getElementById('bgMusic');
} else { let isMusicPlaying = false;
bgMusic.play();
musicBtn.innerText = '🔊';
}
isMusicPlaying = !isMusicPlaying;
});
// Kodingan asli kamu tetap di bawah ini musicBtn.addEventListener('click', () => {
function selectStage(stage) { isMusicPlaying ? bgMusic.pause() : bgMusic.play();
if (stage === "easy") { musicBtn.innerText = isMusicPlaying ? '🔇' : '🔊';
window.location.href = "gameboard-easy.html"; isMusicPlaying = !isMusicPlaying;
} else if (stage === "medium") { });
window.location.href = "gameboard-medium.html";
} else if (stage === "hard") {
window.location.href = "gameboard-hard.html";
}
}
document.getElementById("leaderboardBtn").addEventListener("click", () => {window.location.href = "Leaderboard.html"}); // NAVIGATION
function selectStage(stage) {
window.location.href = "gameboard-" + stage + ".html";
}
document.getElementById("logoutBtn").addEventListener("click", () => { document.getElementById("leaderboardBtn").addEventListener("click", () => {
alert("Logout berhasil!"); window.location.href = "Leaderboard.html";
}); });
</script> document.getElementById("logoutBtn").addEventListener("click", () => {
alert("Logout berhasil!");
});
// OVERLAY CREDITS
function openCredits() {
document.getElementById('creditsOverlay').style.display = 'flex';
}
function closeCredits() {
document.getElementById('creditsOverlay').style.display = 'none';
}
</script>
</body> </body>
</html> </html>