olinux commited on
Commit
e14ffd4
·
verified ·
1 Parent(s): b3b2fc1

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +317 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Manon Game
3
- emoji: 📊
4
- colorFrom: purple
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: manon-game
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,317 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="fr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Math Heroes - Jeu de combat éducatif</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @keyframes pulse {
11
+ 0% { transform: scale(1); }
12
+ 50% { transform: scale(1.05); }
13
+ 100% { transform: scale(1); }
14
+ }
15
+ .pulse-animation {
16
+ animation: pulse 1.5s infinite;
17
+ }
18
+ .damage-animation {
19
+ animation: shake 0.5s;
20
+ }
21
+ @keyframes shake {
22
+ 0% { transform: translateX(0); }
23
+ 25% { transform: translateX(-5px); }
24
+ 50% { transform: translateX(5px); }
25
+ 75% { transform: translateX(-5px); }
26
+ 100% { transform: translateX(0); }
27
+ }
28
+ .health-bar {
29
+ transition: width 0.5s ease;
30
+ }
31
+ .action-btn:hover {
32
+ transform: translateY(-3px);
33
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
34
+ }
35
+ .action-btn {
36
+ transition: all 0.2s ease;
37
+ }
38
+ </style>
39
+ </head>
40
+ <body class="bg-gradient-to-b from-blue-100 to-purple-100 min-h-screen font-sans">
41
+ <div class="container mx-auto px-4 py-8 max-w-4xl">
42
+ <!-- En-tête -->
43
+ <header class="text-center mb-8">
44
+ <h1 class="text-4xl font-bold text-purple-800 mb-2">Math Heroes</h1>
45
+ <p class="text-lg text-gray-600">Apprends les maths en combattant des monstres rigolos !</p>
46
+ </header>
47
+
48
+ <!-- Zone de jeu -->
49
+ <div class="bg-white rounded-xl shadow-lg p-6 mb-6">
50
+ <!-- Environnement -->
51
+ <div class="bg-gradient-to-r from-green-200 to-blue-200 rounded-lg p-4 mb-6 text-center">
52
+ <p class="text-gray-700 font-medium">Forêt des Chiffres Enchantés</p>
53
+ <div class="flex justify-center mt-2">
54
+ <i class="fas fa-tree text-green-600 text-2xl mx-2"></i>
55
+ <i class="fas fa-leaf text-green-500 text-2xl mx-2"></i>
56
+ <i class="fas fa-feather-alt text-yellow-600 text-2xl mx-2"></i>
57
+ </div>
58
+ </div>
59
+
60
+ <!-- Personnages -->
61
+ <div class="flex justify-between items-center mb-8">
62
+ <!-- Joueur -->
63
+ <div class="text-center w-1/3">
64
+ <div class="bg-purple-100 rounded-full p-2 inline-block mb-2">
65
+ <img src="https://img.icons8.com/color/96/000000/knight.png" alt="Héros" class="w-20 h-20">
66
+ </div>
67
+ <h3 class="font-bold text-purple-700">Super Math</h3>
68
+ <div class="bg-gray-200 rounded-full h-4 mb-1">
69
+ <div id="player-health" class="health-bar bg-green-500 rounded-full h-4" style="width: 100%"></div>
70
+ </div>
71
+ <p class="text-sm">PV: <span id="player-hp">100</span>/100</p>
72
+ <div class="mt-2">
73
+ <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Att: 15</span>
74
+ <span class="bg-red-100 text-red-800 text-xs px-2 py-1 rounded ml-1">Déf: 10</span>
75
+ </div>
76
+ </div>
77
+
78
+ <!-- VS -->
79
+ <div class="text-center w-1/3">
80
+ <div class="text-2xl font-bold text-red-500 py-8">VS</div>
81
+ </div>
82
+
83
+ <!-- Ennemi -->
84
+ <div class="text-center w-1/3">
85
+ <div id="enemy" class="bg-red-100 rounded-full p-2 inline-block mb-2 pulse-animation">
86
+ <img src="https://img.icons8.com/color/96/000000/ghost.png" alt="Fantôme" class="w-20 h-20">
87
+ </div>
88
+ <h3 class="font-bold text-red-700">Fantôme Chiffré</h3>
89
+ <div class="bg-gray-200 rounded-full h-4 mb-1">
90
+ <div id="enemy-health" class="health-bar bg-green-500 rounded-full h-4" style="width: 100%"></div>
91
+ </div>
92
+ <p class="text-sm">PV: <span id="enemy-hp">80</span>/80</p>
93
+ <div class="mt-2">
94
+ <span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Att: 12</span>
95
+ <span class="bg-red-100 text-red-800 text-xs px-2 py-1 rounded ml-1">Déf: 8</span>
96
+ </div>
97
+ </div>
98
+ </div>
99
+
100
+ <!-- Zone de texte -->
101
+ <div id="action-text" class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-6 rounded-r">
102
+ <p class="text-gray-800">Un Fantôme Chiffré apparaît ! Que vas-tu faire ?</p>
103
+ </div>
104
+
105
+ <!-- Actions -->
106
+ <div class="grid grid-cols-2 gap-4">
107
+ <button onclick="playerAttack()" class="action-btn bg-red-500 hover:bg-red-600 text-white py-3 px-4 rounded-lg flex items-center justify-center">
108
+ <i class="fas fa-bolt mr-2"></i> Attaquer (15 - 2 = ?)
109
+ </button>
110
+ <button onclick="playerDefend()" class="action-btn bg-blue-500 hover:bg-blue-600 text-white py-3 px-4 rounded-lg flex items-center justify-center">
111
+ <i class="fas fa-shield-alt mr-2"></i> Défendre (+5 défense)
112
+ </button>
113
+ <button onclick="playerSpecial()" class="action-btn bg-purple-500 hover:bg-purple-600 text-white py-3 px-4 rounded-lg flex items-center justify-center">
114
+ <i class="fas fa-star mr-2"></i> Attaque spéciale (3 × 5 = ?)
115
+ </button>
116
+ <button onclick="playerHeal()" class="action-btn bg-green-500 hover:bg-green-600 text-white py-3 px-4 rounded-lg flex items-center justify-center">
117
+ <i class="fas fa-heart mr-2"></i> Soin (20 ÷ 4 = ?)
118
+ </button>
119
+ </div>
120
+ </div>
121
+
122
+ <!-- Statistiques -->
123
+ <div class="bg-white rounded-xl shadow-lg p-6">
124
+ <h3 class="font-bold text-lg mb-4 text-gray-700">Progression</h3>
125
+ <div class="flex items-center mb-3">
126
+ <div class="w-8 h-8 bg-yellow-400 rounded-full flex items-center justify-center mr-3">
127
+ <i class="fas fa-medal text-white"></i>
128
+ </div>
129
+ <div class="flex-1">
130
+ <div class="flex justify-between text-sm">
131
+ <span>Niveau: 1</span>
132
+ <span>50/100 XP</span>
133
+ </div>
134
+ <div class="bg-gray-200 rounded-full h-2 mt-1">
135
+ <div class="bg-yellow-500 rounded-full h-2" style="width: 50%"></div>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ <div class="grid grid-cols-3 gap-4 mt-4 text-center">
140
+ <div class="bg-blue-50 p-3 rounded-lg">
141
+ <div class="text-blue-600 font-bold text-xl">3</div>
142
+ <div class="text-xs text-gray-600">Victoires</div>
143
+ </div>
144
+ <div class="bg-green-50 p-3 rounded-lg">
145
+ <div class="text-green-600 font-bold text-xl">12</div>
146
+ <div class="text-xs text-gray-600">Calculs réussis</div>
147
+ </div>
148
+ <div class="bg-purple-50 p-3 rounded-lg">
149
+ <div class="text-purple-600 font-bold text-xl">5</div>
150
+ <div class="text-xs text-gray-600">Monstres découverts</div>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </div>
155
+
156
+ <script>
157
+ // Variables du jeu
158
+ let playerHP = 100;
159
+ let enemyHP = 80;
160
+ let playerAttackPower = 15;
161
+ let playerDefense = 10;
162
+ let enemyAttackPower = 12;
163
+ let enemyDefense = 8;
164
+ let gameState = "playerTurn"; // "playerTurn" ou "enemyTurn"
165
+
166
+ // Éléments DOM
167
+ const playerHealthBar = document.getElementById('player-health');
168
+ const playerHPText = document.getElementById('player-hp');
169
+ const enemyHealthBar = document.getElementById('enemy-health');
170
+ const enemyHPText = document.getElementById('enemy-hp');
171
+ const actionText = document.getElementById('action-text');
172
+ const enemyElement = document.getElementById('enemy');
173
+
174
+ // Fonctions du jeu
175
+ function playerAttack() {
176
+ if (gameState !== "playerTurn") return;
177
+
178
+ // Demander la réponse au calcul
179
+ const answer = prompt("Combien font 15 - 2 ?");
180
+ if (answer === "13") {
181
+ const damage = Math.max(1, playerAttackPower - enemyDefense);
182
+ enemyHP -= damage;
183
+ updateEnemyHP();
184
+ actionText.innerHTML = `<p>Super Math attaque avec <strong>Calcul Éclair</strong> et inflige <strong class="text-red-500">${damage} dégâts</strong> ! (15 - 2 = 13)</p>`;
185
+
186
+ // Animation de dégâts
187
+ enemyElement.classList.add('damage-animation');
188
+ setTimeout(() => {
189
+ enemyElement.classList.remove('damage-animation');
190
+ }, 500);
191
+
192
+ checkBattleStatus();
193
+ } else {
194
+ actionText.innerHTML = `<p class="text-red-500">Mauvaise réponse ! 15 - 2 = 13. Essaie encore !</p>`;
195
+ }
196
+ }
197
+
198
+ function playerDefend() {
199
+ if (gameState !== "playerTurn") return;
200
+
201
+ playerDefense += 5;
202
+ actionText.innerHTML = `<p>Super Math se prépare à défendre et augmente sa défense de <strong class="text-blue-500">+5</strong> !</p>`;
203
+ nextTurn();
204
+ }
205
+
206
+ function playerSpecial() {
207
+ if (gameState !== "playerTurn") return;
208
+
209
+ const answer = prompt("Combien font 3 × 5 ?");
210
+ if (answer === "15") {
211
+ const damage = Math.max(1, playerAttackPower * 2 - enemyDefense);
212
+ enemyHP -= damage;
213
+ updateEnemyHP();
214
+ actionText.innerHTML = `<p>Super Math utilise <strong>Multipli-Foudre</strong> et inflige <strong class="text-red-500">${damage} dégâts</strong> ! (3 × 5 = 15)</p>`;
215
+
216
+ enemyElement.classList.add('damage-animation');
217
+ setTimeout(() => {
218
+ enemyElement.classList.remove('damage-animation');
219
+ }, 500);
220
+
221
+ checkBattleStatus();
222
+ } else {
223
+ actionText.innerHTML = `<p class="text-red-500">Mauvaise réponse ! 3 × 5 = 15. Essaie encore !</p>`;
224
+ }
225
+ }
226
+
227
+ function playerHeal() {
228
+ if (gameState !== "playerTurn") return;
229
+
230
+ const answer = prompt("Combien font 20 ÷ 4 ?");
231
+ if (answer === "5") {
232
+ const healAmount = 25;
233
+ playerHP = Math.min(100, playerHP + healAmount);
234
+ updatePlayerHP();
235
+ actionText.innerHTML = `<p>Super Math utilise <strong>Potion Mathématique</strong> et récupère <strong class="text-green-500">${healAmount} PV</strong> ! (20 ÷ 4 = 5)</p>`;
236
+ nextTurn();
237
+ } else {
238
+ actionText.innerHTML = `<p class="text-red-500">Mauvaise réponse ! 20 ÷ 4 = 5. Essaie encore !</p>`;
239
+ }
240
+ }
241
+
242
+ function enemyTurn() {
243
+ gameState = "enemyTurn";
244
+
245
+ setTimeout(() => {
246
+ const damage = Math.max(1, enemyAttackPower - playerDefense);
247
+ playerHP -= damage;
248
+ updatePlayerHP();
249
+ actionText.innerHTML = `<p>Le Fantôme Chiffré attaque et inflige <strong class="text-red-500">${damage} dégâts</strong> !</p>`;
250
+
251
+ checkBattleStatus();
252
+ }, 1500);
253
+ }
254
+
255
+ function nextTurn() {
256
+ gameState = "enemyTurn";
257
+ setTimeout(enemyTurn, 1000);
258
+ }
259
+
260
+ function checkBattleStatus() {
261
+ if (enemyHP <= 0) {
262
+ enemyHP = 0;
263
+ updateEnemyHP();
264
+ setTimeout(() => {
265
+ actionText.innerHTML = `<p class="text-green-600 font-bold">Victoire ! Tu as vaincu le Fantôme Chiffré !</p>`;
266
+ gameState = "gameOver";
267
+ }, 500);
268
+ return;
269
+ }
270
+
271
+ if (playerHP <= 0) {
272
+ playerHP = 0;
273
+ updatePlayerHP();
274
+ setTimeout(() => {
275
+ actionText.innerHTML = `<p class="text-red-600 font-bold">Défaite... Le Fantôme Chiffré t'a vaincu !</p>`;
276
+ gameState = "gameOver";
277
+ }, 500);
278
+ return;
279
+ }
280
+
281
+ if (gameState === "playerTurn") {
282
+ nextTurn();
283
+ } else {
284
+ gameState = "playerTurn";
285
+ }
286
+ }
287
+
288
+ function updatePlayerHP() {
289
+ const percentage = (playerHP / 100) * 100;
290
+ playerHealthBar.style.width = `${percentage}%`;
291
+ playerHPText.textContent = playerHP;
292
+
293
+ if (percentage < 30) {
294
+ playerHealthBar.classList.remove('bg-green-500');
295
+ playerHealthBar.classList.add('bg-red-500');
296
+ } else {
297
+ playerHealthBar.classList.remove('bg-red-500');
298
+ playerHealthBar.classList.add('bg-green-500');
299
+ }
300
+ }
301
+
302
+ function updateEnemyHP() {
303
+ const percentage = (enemyHP / 80) * 100;
304
+ enemyHealthBar.style.width = `${percentage}%`;
305
+ enemyHPText.textContent = enemyHP;
306
+
307
+ if (percentage < 30) {
308
+ enemyHealthBar.classList.remove('bg-green-500');
309
+ enemyHealthBar.classList.add('bg-red-500');
310
+ } else {
311
+ enemyHealthBar.classList.remove('bg-red-500');
312
+ enemyHealthBar.classList.add('bg-green-500');
313
+ }
314
+ }
315
+ </script>
316
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=olinux/manon-game" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
317
+ </html>