APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
2b33e31589
commit
d2a837ea17
7 files changed
+2445
-37
No files matched your search
+54
-23
@@ -267,7 +267,10 @@
|
||||
|
||||
<div class="game-card">
|
||||
<div class="header-bar">
|
||||
<div>🦖 <strong id="dinoTitleText">Chrome T-Rex Runner</strong></div>
|
||||
<div style="display:flex;align-items:center;gap:4px">
|
||||
🦖 <strong id="dinoTitleText">Chrome T-Rex Runner</strong>
|
||||
<span id="dinoLevelBadge" style="font-size:11px;padding:2px 8px;border-radius:12px;background:var(--panel-box);border:1px solid var(--border);color:var(--blue);margin-left:8px;font-weight:700;transition:transform 0.2s ease">Niveau 1</span>
|
||||
</div>
|
||||
<div class="scores">
|
||||
<span class="hi">HI <span id="hiScore">00000</span></span>
|
||||
<span id="currentScore">00000</span>
|
||||
@@ -324,21 +327,26 @@
|
||||
}
|
||||
};
|
||||
|
||||
let currentDinoLang = 'fr';
|
||||
let lastLevel = 1;
|
||||
|
||||
function applyDinoLang(lang) {
|
||||
const l = (lang && (lang.startsWith('en') ? 'en' : 'fr')) || 'fr';
|
||||
const dict = I18N_DINO[l] || I18N_DINO.fr;
|
||||
currentDinoLang = (lang && (lang.startsWith('en') ? 'en' : 'fr')) || 'fr';
|
||||
const dict = I18N_DINO[currentDinoLang] || I18N_DINO.fr;
|
||||
const tEl = document.getElementById('dinoTitleText');
|
||||
const goEl = document.getElementById('dinoGameOverText');
|
||||
const rbEl = document.getElementById('dinoRestartBtn');
|
||||
const hjEl = document.getElementById('dinoHintJump');
|
||||
const hdEl = document.getElementById('dinoHintDuck');
|
||||
const htEl = document.getElementById('dinoHintTouch');
|
||||
const badge = document.getElementById('dinoLevelBadge');
|
||||
if (tEl) tEl.textContent = dict.title;
|
||||
if (goEl) goEl.innerHTML = dict.game_over;
|
||||
if (rbEl) rbEl.textContent = dict.restart_btn;
|
||||
if (hjEl) hjEl.innerHTML = dict.hint_jump;
|
||||
if (hdEl) hdEl.innerHTML = dict.hint_duck;
|
||||
if (htEl) htEl.textContent = dict.hint_touch;
|
||||
if (badge) badge.textContent = (currentDinoLang.startsWith('en') ? 'Level ' : 'Niveau ') + lastLevel;
|
||||
}
|
||||
applyDinoLang(urlParams.get('lang'));
|
||||
|
||||
@@ -477,6 +485,7 @@
|
||||
gameStarted = true;
|
||||
score = 0;
|
||||
gameSpeed = 6;
|
||||
lastLevel = 1;
|
||||
nextObstacleTimer = 90; // Période de grâce de 1.5s à chaque reprise
|
||||
obstacles = [];
|
||||
dino.y = GROUND_Y - 44;
|
||||
@@ -487,32 +496,35 @@
|
||||
overlay.style.display = 'none';
|
||||
document.body.classList.remove('night-mode');
|
||||
isNight = false;
|
||||
const badge = document.getElementById('dinoLevelBadge');
|
||||
if (badge) badge.textContent = (currentDinoLang.startsWith('en') ? 'Level 1' : 'Niveau 1');
|
||||
}
|
||||
|
||||
function spawnObstacle() {
|
||||
// Les ptérodactyles n'apparaissent qu'à partir de 450 points
|
||||
const allowPtero = score > 450;
|
||||
const type = (allowPtero && Math.random() < 0.28) ? 'ptero' : 'cactus';
|
||||
// Les ptérodactyles apparaissent dès 280 points (plus palpitant)
|
||||
const allowPtero = score > 280;
|
||||
const pteroChance = score > 600 ? 0.35 : 0.25;
|
||||
const type = (allowPtero && Math.random() < pteroChance) ? 'ptero' : 'cactus';
|
||||
|
||||
if (type === 'cactus') {
|
||||
let isBig = false;
|
||||
let count = 1;
|
||||
|
||||
// Difficulté progressive équitable
|
||||
if (score < 100) {
|
||||
// Début : 1 seul petit cactus (accessible pour s'échauffer)
|
||||
if (score < 120) {
|
||||
// Niveau 1 : 1 seul petit cactus (accessible)
|
||||
isBig = false;
|
||||
count = 1;
|
||||
} else if (score < 250) {
|
||||
// 1 cactus petit ou grand
|
||||
} else if (score < 300) {
|
||||
// Niveau 2 : 1 cactus petit ou grand
|
||||
isBig = Math.random() < 0.45;
|
||||
count = 1;
|
||||
} else if (score < 450) {
|
||||
// 1 ou 2 cactus
|
||||
isBig = Math.random() < 0.4;
|
||||
} else if (score < 550) {
|
||||
// Niveau 3 : 1 ou 2 cactus
|
||||
isBig = Math.random() < 0.45;
|
||||
count = Math.random() < 0.6 ? 1 : 2;
|
||||
} else {
|
||||
// Vitesse élevée : jusqu'à 3 petits ou 2 grands
|
||||
// Niveaux 4 & 5 : jusqu'à 3 petits ou 2 grands
|
||||
isBig = Math.random() < 0.45;
|
||||
count = isBig ? (Math.random() < 0.65 ? 1 : 2) : (Math.floor(Math.random() * 3) + 1);
|
||||
}
|
||||
@@ -528,7 +540,7 @@
|
||||
isBig: isBig
|
||||
});
|
||||
} else {
|
||||
// Ptérodactyles : hauteurs adaptées (haut = passer dessous, bas = sauter par dessus)
|
||||
// Ptérodactyles : 3 hauteurs distinctes (basse = sauter, moyenne = se baisser obligatoirement, haute = passer dessous)
|
||||
const heights = [GROUND_Y - 32, GROUND_Y - 55, GROUND_Y - 78];
|
||||
const h = heights[Math.floor(Math.random() * heights.length)];
|
||||
obstacles.push({
|
||||
@@ -655,12 +667,31 @@
|
||||
|
||||
function update() {
|
||||
if (gameStarted && !gameOver) {
|
||||
// Increase speed slowly
|
||||
gameSpeed += 0.0018;
|
||||
score += 0.2;
|
||||
const currentIntScore = Math.floor(score);
|
||||
currentScoreEl.textContent = String(currentIntScore).padStart(5, '0');
|
||||
|
||||
// Calcul dynamique du niveau (1 à 5)
|
||||
let currentLevel = 1;
|
||||
if (score >= 900) currentLevel = 5;
|
||||
else if (score >= 600) currentLevel = 4;
|
||||
else if (score >= 350) currentLevel = 3;
|
||||
else if (score >= 150) currentLevel = 2;
|
||||
|
||||
if (currentLevel !== lastLevel) {
|
||||
lastLevel = currentLevel;
|
||||
const badge = document.getElementById('dinoLevelBadge');
|
||||
if (badge) {
|
||||
badge.textContent = (currentDinoLang.startsWith('en') ? 'Level ' : 'Niveau ') + currentLevel;
|
||||
badge.style.transform = 'scale(1.25)';
|
||||
setTimeout(() => { if (badge) badge.style.transform = 'scale(1)'; }, 350);
|
||||
}
|
||||
playTone('score');
|
||||
}
|
||||
|
||||
// Vitesse progressive qui monte au fur et à mesure (de 6.0 à 13.5 max)
|
||||
gameSpeed = Math.min(13.5, 6.0 + Math.sqrt(score) * 0.26);
|
||||
|
||||
// High score
|
||||
if (currentIntScore > highScore) {
|
||||
highScore = currentIntScore;
|
||||
@@ -668,14 +699,14 @@
|
||||
localStorage.setItem('ap_dino_hi', highScore);
|
||||
}
|
||||
|
||||
// Night mode toggle every 700 points
|
||||
const nightCycle = Math.floor(score / 700) % 2 === 1;
|
||||
// Alternance Jour / Nuit tous les 600 points
|
||||
const nightCycle = Math.floor(score / 600) % 2 === 1;
|
||||
if (nightCycle !== isNight) {
|
||||
isNight = nightCycle;
|
||||
document.body.classList.toggle('night-mode', isNight);
|
||||
}
|
||||
|
||||
// Score milestone beep
|
||||
// Son de palier tous les 100 points
|
||||
if (currentIntScore > 0 && currentIntScore % 100 === 0 && Math.floor((score - 0.2)) % 100 !== 0) {
|
||||
playTone('score');
|
||||
}
|
||||
@@ -701,9 +732,9 @@
|
||||
nextObstacleTimer -= 1;
|
||||
if (nextObstacleTimer <= 0) {
|
||||
spawnObstacle();
|
||||
// Intervalle équitable garantissant au joueur le temps de réatterrir (minimum 50 frames même à pleine vitesse)
|
||||
const minFrames = Math.max(50, 95 - Math.floor(score / 40));
|
||||
const randomVariance = Math.floor(Math.random() * 45);
|
||||
// Intervalle équitable proportionnel à la vitesse (garantit toujours >= 330px d'espace entre les obstacles)
|
||||
const minFrames = Math.max(38, Math.round(330 / gameSpeed));
|
||||
const randomVariance = Math.floor(Math.random() * (Math.max(20, Math.round(180 / gameSpeed))));
|
||||
nextObstacleTimer = minFrames + randomVariance;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user