NONE OF THE buttons work
Browse files- components/game-card.js +3 -4
- index.html +5 -5
- script.js +20 -0
components/game-card.js
CHANGED
|
@@ -130,9 +130,9 @@ class GameCard extends HTMLElement {
|
|
| 130 |
}
|
| 131 |
}, 100);
|
| 132 |
}
|
| 133 |
-
|
| 134 |
addEventListeners() {
|
| 135 |
-
this.shadowRoot.addEventListener('click', () => {
|
|
|
|
| 136 |
const title = this.getAttribute('title');
|
| 137 |
const color = this.getAttribute('color');
|
| 138 |
|
|
@@ -140,8 +140,7 @@ class GameCard extends HTMLElement {
|
|
| 140 |
this.showGameOverlay(title, color);
|
| 141 |
});
|
| 142 |
}
|
| 143 |
-
|
| 144 |
-
showGameOverlay(title, color) {
|
| 145 |
const overlay = document.createElement('div');
|
| 146 |
overlay.className = 'fixed inset-0 bg-black bg-opacity-80 flex items-center justify-center z-50';
|
| 147 |
overlay.innerHTML = `
|
|
|
|
| 130 |
}
|
| 131 |
}, 100);
|
| 132 |
}
|
|
|
|
| 133 |
addEventListeners() {
|
| 134 |
+
this.shadowRoot.querySelector('.play-button').addEventListener('click', (e) => {
|
| 135 |
+
e.stopPropagation();
|
| 136 |
const title = this.getAttribute('title');
|
| 137 |
const color = this.getAttribute('color');
|
| 138 |
|
|
|
|
| 140 |
this.showGameOverlay(title, color);
|
| 141 |
});
|
| 142 |
}
|
| 143 |
+
showGameOverlay(title, color) {
|
|
|
|
| 144 |
const overlay = document.createElement('div');
|
| 145 |
overlay.className = 'fixed inset-0 bg-black bg-opacity-80 flex items-center justify-center z-50';
|
| 146 |
overlay.innerHTML = `
|
index.html
CHANGED
|
@@ -39,7 +39,7 @@
|
|
| 39 |
<section id="game-modes" class="mb-12">
|
| 40 |
<h2 class="text-3xl font-bold mb-6 border-b-2 border-green-600 pb-2">Game Modes</h2>
|
| 41 |
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 42 |
-
<div class="bg-gray-800 p-6 rounded-xl hover:bg-gray-700 transition-all cursor-pointer"
|
| 43 |
<div class="flex items-center mb-4">
|
| 44 |
<i data-feather="zap" class="w-8 h-8 text-yellow-400 mr-3"></i>
|
| 45 |
<h3 class="text-xl font-bold">Quick Match</h3>
|
|
@@ -61,11 +61,11 @@
|
|
| 61 |
</div>
|
| 62 |
</div>
|
| 63 |
|
| 64 |
-
<div class="bg-gray-800 p-6 rounded-xl hover:bg-gray-700 transition-all cursor-pointer"
|
| 65 |
</div>
|
| 66 |
</div>
|
| 67 |
|
| 68 |
-
<div class="bg-gray-800 p-6 rounded-xl hover:bg-gray-700 transition-all cursor-pointer"
|
| 69 |
<div class="flex items-center mb-4">
|
| 70 |
<i data-feather="users" class="w-8 h-8 text-blue-400 mr-3"></i>
|
| 71 |
<h3 class="text-xl font-bold">Multiplayer</h3>
|
|
@@ -83,10 +83,10 @@
|
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
|
| 86 |
-
<div class="bg-gray-800 p-6 rounded-xl hover:bg-gray-700 transition-all cursor-pointer"
|
| 87 |
</div>
|
| 88 |
</div>
|
| 89 |
-
|
| 90 |
</section>
|
| 91 |
<!-- Player Profile -->
|
| 92 |
<section id="profile" class="mb-12 bg-gray-800 rounded-xl p-6">
|
|
|
|
| 39 |
<section id="game-modes" class="mb-12">
|
| 40 |
<h2 class="text-3xl font-bold mb-6 border-b-2 border-green-600 pb-2">Game Modes</h2>
|
| 41 |
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 42 |
+
<div class="bg-gray-800 p-6 rounded-xl hover:bg-gray-700 transition-all cursor-pointer" data-game-mode="quick-match" data-difficulty="medium">
|
| 43 |
<div class="flex items-center mb-4">
|
| 44 |
<i data-feather="zap" class="w-8 h-8 text-yellow-400 mr-3"></i>
|
| 45 |
<h3 class="text-xl font-bold">Quick Match</h3>
|
|
|
|
| 61 |
</div>
|
| 62 |
</div>
|
| 63 |
|
| 64 |
+
<div class="bg-gray-800 p-6 rounded-xl hover:bg-gray-700 transition-all cursor-pointer" data-game-mode="quick-match" data-difficulty="hard">
|
| 65 |
</div>
|
| 66 |
</div>
|
| 67 |
|
| 68 |
+
<div class="bg-gray-800 p-6 rounded-xl hover:bg-gray-700 transition-all cursor-pointer" data-game-mode="daily-challenge">
|
| 69 |
<div class="flex items-center mb-4">
|
| 70 |
<i data-feather="users" class="w-8 h-8 text-blue-400 mr-3"></i>
|
| 71 |
<h3 class="text-xl font-bold">Multiplayer</h3>
|
|
|
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
|
| 86 |
+
<div class="bg-gray-800 p-6 rounded-xl hover:bg-gray-700 transition-all cursor-pointer" data-game-mode="training">
|
| 87 |
</div>
|
| 88 |
</div>
|
| 89 |
+
</div>
|
| 90 |
</section>
|
| 91 |
<!-- Player Profile -->
|
| 92 |
<section id="profile" class="mb-12 bg-gray-800 rounded-xl p-6">
|
script.js
CHANGED
|
@@ -125,6 +125,26 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 125 |
game.addXP(xp);
|
| 126 |
}
|
| 127 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
});
|
| 129 |
function startQuickMatch(difficulty) {
|
| 130 |
// Simulate match and rewards based on difficulty
|
|
|
|
| 125 |
game.addXP(xp);
|
| 126 |
}
|
| 127 |
});
|
| 128 |
+
|
| 129 |
+
// Add click event listeners to game mode cards
|
| 130 |
+
document.querySelectorAll('[data-game-mode]').forEach(card => {
|
| 131 |
+
card.addEventListener('click', (e) => {
|
| 132 |
+
const gameMode = card.getAttribute('data-game-mode');
|
| 133 |
+
const difficulty = card.getAttribute('data-difficulty');
|
| 134 |
+
|
| 135 |
+
switch(gameMode) {
|
| 136 |
+
case 'quick-match':
|
| 137 |
+
startQuickMatch(difficulty);
|
| 138 |
+
break;
|
| 139 |
+
case 'daily-challenge':
|
| 140 |
+
startDailyChallenge();
|
| 141 |
+
break;
|
| 142 |
+
case 'training':
|
| 143 |
+
startTraining();
|
| 144 |
+
break;
|
| 145 |
+
}
|
| 146 |
+
});
|
| 147 |
+
});
|
| 148 |
});
|
| 149 |
function startQuickMatch(difficulty) {
|
| 150 |
// Simulate match and rewards based on difficulty
|