PAUTREL Johan commited on
Commit
ddee145
·
verified ·
1 Parent(s): 7d0e83d

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +88 -14
index.html CHANGED
@@ -88,6 +88,11 @@
88
  opacity: 0;
89
  animation: fadeIn 0.5s forwards, shake 0.5s forwards;
90
  }
 
 
 
 
 
91
  </style>
92
  </head>
93
  <body class="bg-gray-100 font-sans">
@@ -100,6 +105,9 @@
100
  <h1 class="text-2xl font-bold">AJNET PRO</h1>
101
  </div>
102
  <div class="flex items-center space-x-4">
 
 
 
103
  <div id="combo-counter" class="hidden bg-blue-800 px-3 py-1 rounded-full font-bold text-sm">
104
  Combo x<span id="combo">0</span>
105
  </div>
@@ -169,6 +177,52 @@
169
  </div>
170
  </div>
171
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  </main>
173
 
174
  <!-- Footer -->
@@ -187,14 +241,14 @@
187
  let timeInterval;
188
  let gameActive = false;
189
  let stainsCleaned = 0;
190
- let maxStains = 10; // Reduced to make it harder
191
- let stainSpeed = 1500; // Faster initial spawn
192
  let lastCleanTime = 0;
193
  let combo = 0;
194
  let maxCombo = 0;
195
  let comboTimeout;
196
- let movingStainChance = 0.4; // 40% chance for moving stains
197
- let penaltyStainChance = 0.2; // 20% chance for penalty stains
198
  let stainCount = 0;
199
 
200
  // DOM elements
@@ -213,6 +267,10 @@
213
  const shareBtn = document.getElementById('share-btn');
214
  const comboCounter = document.getElementById('combo-counter');
215
  const comboDisplay = document.getElementById('combo');
 
 
 
 
216
 
217
  // Stain types with different colors, sizes and behaviors
218
  const stainTypes = [
@@ -232,8 +290,8 @@
232
  timeLeft = 60;
233
  level = 1;
234
  stainsCleaned = 0;
235
- maxStains = 10;
236
- stainSpeed = 1500;
237
  combo = 0;
238
  maxCombo = 0;
239
  stainCount = 0;
@@ -252,6 +310,7 @@
252
  gameActive = true;
253
  startScreen.classList.add('hidden');
254
  gameOverScreen.classList.add('hidden');
 
255
 
256
  // Start timers
257
  timeInterval = setInterval(updateTimer, 1000);
@@ -261,16 +320,20 @@
261
  gameInterval = setInterval(checkGameState, 500);
262
  }
263
 
264
- // Create a new stain
265
  function createStain() {
266
  if (!gameActive || stainCount >= maxStains) return;
267
 
268
  const gameAreaRect = gameArea.getBoundingClientRect();
269
- const maxX = gameAreaRect.width - 100;
270
- const maxY = gameAreaRect.height - 100;
271
 
272
- const x = Math.floor(Math.random() * maxX);
273
- const y = Math.floor(Math.random() * maxY);
 
 
 
 
274
 
275
  // Determine if this should be a moving or penalty stain
276
  let stainTypeIndex = Math.floor(Math.random() * (stainTypes.length - 2)); // Default to normal stains
@@ -419,9 +482,9 @@
419
 
420
  // Increase difficulty
421
  maxStains = Math.min(maxStains + 2, 20); // Cap at 20 stains
422
- stainSpeed = Math.max(stainSpeed - 200, 500); // Faster spawn but not too fast
423
- movingStainChance = Math.min(movingStainChance + 0.05, 0.6); // More moving stains
424
- penaltyStainChance = Math.min(penaltyStainChance + 0.02, 0.3); // More penalty stains
425
 
426
  // Update display
427
  updateLevel();
@@ -509,6 +572,17 @@
509
  shareBtn.addEventListener('click', () => {
510
  alert(`Partagez votre score de ${score} points (Niveau ${level}) avec vos amis!`);
511
  });
 
 
 
 
 
 
 
 
 
 
 
512
 
513
  // Initialize game on load
514
  initGame();
 
88
  opacity: 0;
89
  animation: fadeIn 0.5s forwards, shake 0.5s forwards;
90
  }
91
+
92
+ .rules-modal {
93
+ max-height: 80vh;
94
+ overflow-y: auto;
95
+ }
96
  </style>
97
  </head>
98
  <body class="bg-gray-100 font-sans">
 
105
  <h1 class="text-2xl font-bold">AJNET PRO</h1>
106
  </div>
107
  <div class="flex items-center space-x-4">
108
+ <button id="rules-btn" class="bg-blue-800 px-3 py-1 rounded-full font-bold text-sm hover:bg-blue-700 transition">
109
+ <i class="fas fa-info-circle mr-1"></i>Règles
110
+ </button>
111
  <div id="combo-counter" class="hidden bg-blue-800 px-3 py-1 rounded-full font-bold text-sm">
112
  Combo x<span id="combo">0</span>
113
  </div>
 
177
  </div>
178
  </div>
179
  </div>
180
+
181
+ <!-- Rules Modal -->
182
+ <div id="rules-modal" class="modal absolute inset-0 bg-blue-600 bg-opacity-90 hidden flex-col items-center justify-center text-white">
183
+ <div class="rules-modal bg-blue-800 p-6 rounded-xl max-w-md mx-4">
184
+ <div class="flex justify-between items-center mb-4">
185
+ <h2 class="text-2xl font-bold"><i class="fas fa-book mr-2"></i>Règles du Jeu</h2>
186
+ <button id="close-rules-btn" class="text-white hover:text-blue-200 text-2xl">
187
+ <i class="fas fa-times"></i>
188
+ </button>
189
+ </div>
190
+ <div class="space-y-4">
191
+ <div class="bg-blue-700 p-4 rounded-lg">
192
+ <h3 class="font-bold text-lg mb-2"><i class="fas fa-broom mr-2"></i>Objectif</h3>
193
+ <p>Nettoyer le maximum de taches en 60 secondes pour marquer des points.</p>
194
+ </div>
195
+ <div class="bg-blue-700 p-4 rounded-lg">
196
+ <h3 class="font-bold text-lg mb-2"><i class="fas fa-star mr-2"></i>Points</h3>
197
+ <ul class="list-disc pl-5 space-y-1">
198
+ <li>Taches normales: 1-3 points selon la taille</li>
199
+ <li>Taches mobiles: 2-4 points (plus difficiles à attraper)</li>
200
+ <li>Bonus de combo: +1 point par niveau de combo</li>
201
+ </ul>
202
+ </div>
203
+ <div class="bg-blue-700 p-4 rounded-lg">
204
+ <h3 class="font-bold text-lg mb-2"><i class="fas fa-skull mr-2"></i>Pénalités</h3>
205
+ <ul class="list-disc pl-5 space-y-1">
206
+ <li>Taches noires: -3 points</li>
207
+ <li>Taches rouges: -5 points</li>
208
+ </ul>
209
+ </div>
210
+ <div class="bg-blue-700 p-4 rounded-lg">
211
+ <h3 class="font-bold text-lg mb-2"><i class="fas fa-bolt mr-2"></i>Combo</h3>
212
+ <p>Nettoyer plusieurs taches rapidement augmente votre combo (max x10). Le combo se réinitialise après 1 seconde sans nettoyer de tache.</p>
213
+ </div>
214
+ <div class="bg-blue-700 p-4 rounded-lg">
215
+ <h3 class="font-bold text-lg mb-2"><i class="fas fa-level-up-alt mr-2"></i>Niveaux</h3>
216
+ <p>Nettoyer 10 taches vous fait passer au niveau suivant. La difficulté augmente avec plus de taches mobiles et pénalisantes.</p>
217
+ </div>
218
+ </div>
219
+ <div class="mt-6 text-center">
220
+ <button id="start-from-rules-btn" class="btn-pulse bg-white text-blue-600 font-bold py-3 px-8 rounded-full text-lg hover:bg-blue-100 transition">
221
+ COMMENCER
222
+ </button>
223
+ </div>
224
+ </div>
225
+ </div>
226
  </main>
227
 
228
  <!-- Footer -->
 
241
  let timeInterval;
242
  let gameActive = false;
243
  let stainsCleaned = 0;
244
+ let maxStains = 12; // Increased max stains
245
+ let stainSpeed = 800; // Much faster spawn rate
246
  let lastCleanTime = 0;
247
  let combo = 0;
248
  let maxCombo = 0;
249
  let comboTimeout;
250
+ let movingStainChance = 0.5; // 50% chance for moving stains
251
+ let penaltyStainChance = 0.25; // 25% chance for penalty stains
252
  let stainCount = 0;
253
 
254
  // DOM elements
 
267
  const shareBtn = document.getElementById('share-btn');
268
  const comboCounter = document.getElementById('combo-counter');
269
  const comboDisplay = document.getElementById('combo');
270
+ const rulesBtn = document.getElementById('rules-btn');
271
+ const rulesModal = document.getElementById('rules-modal');
272
+ const closeRulesBtn = document.getElementById('close-rules-btn');
273
+ const startFromRulesBtn = document.getElementById('start-from-rules-btn');
274
 
275
  // Stain types with different colors, sizes and behaviors
276
  const stainTypes = [
 
290
  timeLeft = 60;
291
  level = 1;
292
  stainsCleaned = 0;
293
+ maxStains = 12;
294
+ stainSpeed = 800;
295
  combo = 0;
296
  maxCombo = 0;
297
  stainCount = 0;
 
310
  gameActive = true;
311
  startScreen.classList.add('hidden');
312
  gameOverScreen.classList.add('hidden');
313
+ rulesModal.classList.add('hidden');
314
 
315
  // Start timers
316
  timeInterval = setInterval(updateTimer, 1000);
 
320
  gameInterval = setInterval(checkGameState, 500);
321
  }
322
 
323
+ // Create a new stain (now more centered)
324
  function createStain() {
325
  if (!gameActive || stainCount >= maxStains) return;
326
 
327
  const gameAreaRect = gameArea.getBoundingClientRect();
328
+ const centerX = gameAreaRect.width / 2;
329
+ const centerY = gameAreaRect.height / 2;
330
 
331
+ // Create stains more towards the center (within 60% of screen centered)
332
+ const areaWidth = gameAreaRect.width * 0.6;
333
+ const areaHeight = gameAreaRect.height * 0.6;
334
+
335
+ const x = centerX - (areaWidth / 2) + Math.random() * areaWidth;
336
+ const y = centerY - (areaHeight / 2) + Math.random() * areaHeight;
337
 
338
  // Determine if this should be a moving or penalty stain
339
  let stainTypeIndex = Math.floor(Math.random() * (stainTypes.length - 2)); // Default to normal stains
 
482
 
483
  // Increase difficulty
484
  maxStains = Math.min(maxStains + 2, 20); // Cap at 20 stains
485
+ stainSpeed = Math.max(stainSpeed - 100, 400); // Even faster spawn
486
+ movingStainChance = Math.min(movingStainChance + 0.05, 0.7); // More moving stains
487
+ penaltyStainChance = Math.min(penaltyStainChance + 0.02, 0.35); // More penalty stains
488
 
489
  // Update display
490
  updateLevel();
 
572
  shareBtn.addEventListener('click', () => {
573
  alert(`Partagez votre score de ${score} points (Niveau ${level}) avec vos amis!`);
574
  });
575
+
576
+ // Rules modal
577
+ rulesBtn.addEventListener('click', () => {
578
+ rulesModal.classList.remove('hidden');
579
+ });
580
+
581
+ closeRulesBtn.addEventListener('click', () => {
582
+ rulesModal.classList.add('hidden');
583
+ });
584
+
585
+ startFromRulesBtn.addEventListener('click', startGame);
586
 
587
  // Initialize game on load
588
  initGame();