Merge branch 'main' of https://git-eng.ukwms.ac.id/2526-web/Kelompok02-Memory-Card
This commit is contained in:
commit
c798406c5e
@ -5,23 +5,28 @@
|
|||||||
<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>
|
||||||
body {
|
html, body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background: linear-gradient(135deg, #8929ff 30%, #ff419b 100%);
|
height: 100%;
|
||||||
background-attachment: fixed;
|
overflow: hidden; /* hilangkan scroll */
|
||||||
font-family: "Poppins", sans-serif;
|
font-family: "Poppins", sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: linear-gradient(135deg, #8929ff 30%, #ff419b 100%);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Top bar */
|
||||||
.topbar {
|
.topbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 8px 14px;
|
padding: 8px 14px;
|
||||||
background: rgb(255, 255, 255);
|
background: rgba(255, 255, 255, 0.45);
|
||||||
border-bottom: 2px solid rgba(39, 35, 35, 0.6);
|
border-bottom: 2px solid rgba(39, 35, 35, 0.6);
|
||||||
backdrop-filter: blur(14px);
|
backdrop-filter: blur(14px);
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,31 +48,32 @@ body {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
padding: 5px 12px;
|
padding: 5px 12px;
|
||||||
background: rgb(255, 255, 255);
|
background: rgba(255,255,255,0.45);
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
border: 2px solid rgb(255, 255, 255);
|
border: 2px solid rgba(255,255,255,0.8);
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(8px);
|
||||||
color: #003366;
|
color: #003366;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
box-shadow:
|
box-shadow: 0 3px 6px rgba(0,0,0,0.2), inset 0 0 6px rgba(255,255,255,0.6);
|
||||||
0 3px 6px rgba(0,0,0,0.20),
|
|
||||||
inset 0 0 6px rgba(255,255,255,0.6);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon { font-size: 18px; }
|
.icon { font-size: 18px; }
|
||||||
|
|
||||||
|
/* Gameboard */
|
||||||
.gameboard {
|
.gameboard {
|
||||||
|
flex: 1;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 160px);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
grid-template-rows: repeat(3, 200px);
|
grid-template-rows: repeat(3, 1fr);
|
||||||
justify-content: center;
|
gap: 10px;
|
||||||
gap: 25px;
|
padding: 10px;
|
||||||
margin: 20px auto;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Card */
|
||||||
.card {
|
.card {
|
||||||
width: 140px;
|
width: 100%;
|
||||||
height: 180px;
|
height: 100%;
|
||||||
perspective: 1000px;
|
perspective: 1000px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -78,6 +84,7 @@ body {
|
|||||||
position: relative;
|
position: relative;
|
||||||
transform-style: preserve-3d;
|
transform-style: preserve-3d;
|
||||||
transition: transform 0.55s ease;
|
transition: transform 0.55s ease;
|
||||||
|
border-radius: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.front, .back {
|
.front, .back {
|
||||||
@ -88,16 +95,14 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 18px;
|
border-radius: 12px;
|
||||||
background: linear-gradient(135deg, #7a28ff 20%, #eb2bbf 80%);
|
background: linear-gradient(135deg, #7a28ff 20%, #eb2bbf 80%);
|
||||||
border: 3px solid rgba(255,255,255,0.55);
|
border: 2px solid rgba(255,255,255,0.55);
|
||||||
box-shadow:
|
box-shadow: 0 3px 6px rgba(0,0,0,0.25), inset 0 0 6px rgba(255,255,255,0.45);
|
||||||
0 5px 12px rgba(0,0,0,0.25),
|
|
||||||
inset 0 0 12px rgba(255,255,255,0.45);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.front {
|
.front {
|
||||||
font-size: 60px;
|
font-size: calc(10px + 3vw);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #ff6a4d;
|
color: #ff6a4d;
|
||||||
}
|
}
|
||||||
@ -107,8 +112,9 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.back img {
|
.back img {
|
||||||
max-width: 90%;
|
width: 90%;
|
||||||
max-height: 90%;
|
height: 90%;
|
||||||
|
object-fit: contain;
|
||||||
filter: drop-shadow(0 3px 4px rgba(0,0,0,0.45));
|
filter: drop-shadow(0 3px 4px rgba(0,0,0,0.45));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,34 +123,12 @@ body {
|
|||||||
transition: 0.25s;
|
transition: 0.25s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card.flipped .inner {
|
.card.flipped .inner { transform: rotateY(180deg); }
|
||||||
transform: rotateY(180deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card.matched .front,
|
.card.matched .front,
|
||||||
.card.matched .back {
|
.card.matched .back {
|
||||||
border-color: #7affd6;
|
border-color: #7affd6;
|
||||||
box-shadow:
|
box-shadow: 0 0 15px #7affd6, 0 0 30px rgba(122,255,214,0.8);
|
||||||
0 0 15px #7affd6,
|
|
||||||
0 0 30px rgba(122,255,214,0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.gameboard {
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
|
||||||
gap: 15px;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
width: 100px;
|
|
||||||
height: 130px;
|
|
||||||
}
|
|
||||||
.front {
|
|
||||||
font-size: 40px;
|
|
||||||
}
|
|
||||||
.back img {
|
|
||||||
max-width: 85%;
|
|
||||||
max-height: 85%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@ -172,16 +156,6 @@ const images = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
let cards = [...images, ...images];
|
let cards = [...images, ...images];
|
||||||
|
|
||||||
function shuffle(arr) {
|
|
||||||
let i = arr.length, j;
|
|
||||||
while (i > 0) {
|
|
||||||
j = Math.floor(Math.random() * i--);
|
|
||||||
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
||||||
}
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
let flipped = [];
|
let flipped = [];
|
||||||
let timerStarted = false;
|
let timerStarted = false;
|
||||||
let time = 60;
|
let time = 60;
|
||||||
@ -221,8 +195,7 @@ function flipCard(card) {
|
|||||||
score += 10;
|
score += 10;
|
||||||
document.getElementById("score").textContent = score;
|
document.getElementById("score").textContent = score;
|
||||||
|
|
||||||
// Tambah 5 detik jika benar
|
time += 5; // tambah 5 detik jika cocok
|
||||||
time += 5;
|
|
||||||
document.getElementById("timer").textContent = time;
|
document.getElementById("timer").textContent = time;
|
||||||
|
|
||||||
flipped = [];
|
flipped = [];
|
||||||
@ -239,7 +212,8 @@ function startGame() {
|
|||||||
const board = document.getElementById("game-board");
|
const board = document.getElementById("game-board");
|
||||||
board.innerHTML = "";
|
board.innerHTML = "";
|
||||||
|
|
||||||
shuffle(cards).forEach(image => {
|
// tetap urutan (tidak shuffle)
|
||||||
|
cards.forEach(image => {
|
||||||
const card = document.createElement("div");
|
const card = document.createElement("div");
|
||||||
card.className = "card";
|
card.className = "card";
|
||||||
card.innerHTML = `
|
card.innerHTML = `
|
||||||
@ -265,6 +239,5 @@ function startGame() {
|
|||||||
|
|
||||||
startGame();
|
startGame();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -45,6 +45,7 @@ $user = $_SESSION['user']; // id, username, role
|
|||||||
<p>Grid 3x4 (12 kartu)</p>
|
<p>Grid 3x4 (12 kartu)</p>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
<button class>"stage" onclick="selectStage('medium')">
|
<button class>"stage" onclick="selectStage('medium')">
|
||||||
<h3>Medium Mode</h3>
|
<h3>Medium Mode</h3>
|
||||||
<p>Grid 4x4 (16 kartu)</p>
|
<p>Grid 4x4 (16 kartu)</p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user