Compare commits
2 Commits
3ea1f6a9a0
...
8131f3b8c0
| Author | SHA1 | Date | |
|---|---|---|---|
| 8131f3b8c0 | |||
| e87bd33828 |
@ -4,12 +4,13 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Memory Card Premium</title>
|
<title>Memory Card Premium</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden; /* hilangkan scroll */
|
overflow: hidden;
|
||||||
font-family: "Poppins", sans-serif;
|
font-family: "Poppins", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@ -57,23 +58,22 @@ body {
|
|||||||
box-shadow: 0 3px 6px rgba(0,0,0,0.2), inset 0 0 6px rgba(255,255,255,0.6);
|
box-shadow: 0 3px 6px rgba(0,0,0,0.2), inset 0 0 6px rgba(255,255,255,0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon { font-size: 18px; }
|
|
||||||
|
|
||||||
/* Gameboard */
|
/* Gameboard */
|
||||||
.gameboard {
|
.gameboard {
|
||||||
flex: 1;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(4, 85px); /* 4 kolom */
|
||||||
grid-template-rows: repeat(3, 1fr);
|
grid-template-rows: repeat(3, 105px); /* 3 baris */
|
||||||
gap: 10px;
|
gap: 22px; /* jarak diperbesar */
|
||||||
|
justify-content: center;
|
||||||
|
align-content: center;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
box-sizing: border-box;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Card */
|
/* Card */
|
||||||
.card {
|
.card {
|
||||||
width: 100%;
|
width: 85px;
|
||||||
height: 100%;
|
height: 105px;
|
||||||
perspective: 1000px;
|
perspective: 1000px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.front {
|
.front {
|
||||||
font-size: calc(10px + 3vw);
|
font-size: 22px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #ff6a4d;
|
color: #ff6a4d;
|
||||||
}
|
}
|
||||||
@ -118,11 +118,6 @@ body {
|
|||||||
filter: drop-shadow(0 3px 4px rgba(0,0,0,0.45));
|
filter: drop-shadow(0 3px 4px rgba(0,0,0,0.45));
|
||||||
}
|
}
|
||||||
|
|
||||||
.card:not(.flipped):hover .front {
|
|
||||||
transform: scale(1.05);
|
|
||||||
transition: 0.25s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card.flipped .inner { transform: rotateY(180deg); }
|
.card.flipped .inner { transform: rotateY(180deg); }
|
||||||
|
|
||||||
.card.matched .front,
|
.card.matched .front,
|
||||||
@ -136,21 +131,23 @@ body {
|
|||||||
|
|
||||||
<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">
|
||||||
<div class="pill"><span class="icon">⏱</span><span id="timer">60</span>s</div>
|
<div class="pill"><span>⏱</span> <span id="timer">60</span>s</div>
|
||||||
<div class="pill"><span class="icon">⭐</span><span id="score">0</span></div>
|
<div class="pill"><span>⭐</span> <span id="score">0</span></div>
|
||||||
<div class="pill"><span class="icon">🎯</span><span id="moves">0</span></div>
|
<div class="pill"><span>🎯</span> <span id="moves">0</span></div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="game-board" class="gameboard"></div>
|
<div id="game-board" class="gameboard"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// 6 gambar → total kartu 12 (3x4 pas)
|
||||||
const images = [
|
const images = [
|
||||||
"asset/alpukat.jpg",
|
"asset/alpukat.jpg",
|
||||||
"asset/anggur.jpg",
|
"asset/anggur.jpg",
|
||||||
"asset/apel.jpg",
|
"asset/apel.jpg",
|
||||||
"asset/buah naga.jpg",
|
"asset/buah_naga.jpg", // pastikan tidak pakai spasi
|
||||||
"asset/jambu.jpg",
|
"asset/jambu.jpg",
|
||||||
"asset/jeruk.jpg"
|
"asset/jeruk.jpg"
|
||||||
];
|
];
|
||||||
@ -167,6 +164,7 @@ 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);
|
||||||
alert("Waktu habis!");
|
alert("Waktu habis!");
|
||||||
@ -195,7 +193,7 @@ function flipCard(card){
|
|||||||
score += 10;
|
score += 10;
|
||||||
document.getElementById("score").textContent = score;
|
document.getElementById("score").textContent = score;
|
||||||
|
|
||||||
time += 5; // tambah 5 detik jika cocok
|
time += 5; // bonus waktu
|
||||||
document.getElementById("timer").textContent = time;
|
document.getElementById("timer").textContent = time;
|
||||||
|
|
||||||
flipped = [];
|
flipped = [];
|
||||||
@ -208,11 +206,11 @@ function flipCard(card){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tidak shuffle → tetap 3x4 urutan kartu
|
||||||
function startGame() {
|
function startGame() {
|
||||||
const board = document.getElementById("game-board");
|
const board = document.getElementById("game-board");
|
||||||
board.innerHTML = "";
|
board.innerHTML = "";
|
||||||
|
|
||||||
// tetap urutan (tidak shuffle)
|
|
||||||
cards.forEach(image => {
|
cards.forEach(image => {
|
||||||
const card = document.createElement("div");
|
const card = document.createElement("div");
|
||||||
card.className = "card";
|
card.className = "card";
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
function selectStage(stage) {
|
function selectStage(stage) {
|
||||||
alert("Stage dipilih: " + stage);
|
if (stage === "easy") {
|
||||||
|
window.location.href = "gameboard-easy.html";
|
||||||
|
} 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", () => {
|
document.getElementById("leaderboardBtn").addEventListener("click", () => {
|
||||||
alert("Menuju Leaderboard");
|
alert("Menuju Leaderboard");
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user