From fb95e88eed89a731ca54667d7f93bf7606d597df Mon Sep 17 00:00:00 2001 From: thedevilbox Date: Tue, 2 Dec 2025 00:42:55 +0100 Subject: [PATCH] vitesse fantome parfait chasse ameliorer et logo souri chyanger en fantome --- game.js | 38 ++++++++++++++++++++++---------------- style.css | 2 ++ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/game.js b/game.js index 222c6b4..70205fc 100644 --- a/game.js +++ b/game.js @@ -354,7 +354,7 @@ class Pacman { cherryEatenTimer = Math.max(150, 300 - (level - 1) * 20); // Rendre tous les fantômes vulnérables - const vulnerableTime = Math.max(180, 360 - (level - 1) * 30); + const vulnerableTime = Math.max(60, 180 - (level - 1) * 15); for (let ghost of ghosts) { ghost.isVulnerable = true; ghost.vulnerableTimer = vulnerableTime; @@ -538,7 +538,7 @@ class Ghost { } } - this.moveInterval = Math.max(8, 20 - (level - 1) * 2); + this.moveInterval = Math.max(5, 15 - (level - 1) * 1.5); this.moveCounter++; @@ -555,15 +555,20 @@ class Ghost { // Fuir le joueur quand vulnérable this.direction = this.getDirectionAwayFromPacman(possibleDirections); } else { - // Comportement selon le type - if (this.type === GHOST_HUNTER) { - this.direction = this.getDirectionToPacman(possibleDirections); - } else if (this.type === GHOST_PATROL) { - this.direction = this.getPatrolDirection(possibleDirections); - } else if (this.type === GHOST_FAST || this.type === GHOST_INVISIBLE) { - this.direction = this.getDirectionToPacman(possibleDirections); + // Tous les fantômes chassent le joueur (sauf patrouilleurs qui patrouillent si très loin) + if (this.type === GHOST_PATROL) { + const distance = Math.sqrt( + Math.pow(pacman.x - this.x, 2) + + Math.pow(pacman.y - this.y, 2) + ); + // Si proche, chasser, sinon patrouiller (seulement si très loin) + if (distance < 12) { + this.direction = this.getDirectionToPacman(possibleDirections); + } else { + this.direction = this.getPatrolDirection(possibleDirections); + } } else { - // Normal : toujours poursuivre + // Tous les autres chassent directement this.direction = this.getDirectionToPacman(possibleDirections); } } @@ -595,10 +600,13 @@ class Ghost { let targetX = pacman.x; let targetY = pacman.y; + // Prédiction améliorée pour tous les niveaux + const predictionSteps = level >= 3 ? 4 : 3; + // Si Pacman bouge, prédire où il sera if (pacman.direction !== undefined) { - const futureX = pacman.x + dx[pacman.direction] * 2; - const futureY = pacman.y + dy[pacman.direction] * 2; + const futureX = pacman.x + dx[pacman.direction] * predictionSteps; + const futureY = pacman.y + dy[pacman.direction] * predictionSteps; if (futureX >= 0 && futureX < COLS && futureY >= 0 && futureY < ROWS) { targetX = futureX; targetY = futureY; @@ -612,10 +620,8 @@ class Ghost { const oppositeDirection = (this.direction + 2) % 4; for (let dir of possibleDirections) { - // Éviter la direction opposée sauf si c'est la seule option - if (possibleDirections.length > 1 && dir === oppositeDirection) { - continue; - } + // Permettre le retour en arrière si c'est la meilleure direction + // (pas de restriction pour une poursuite plus agressive) const nextX = this.x + dx[dir]; const nextY = this.y + dy[dir]; diff --git a/style.css b/style.css index 832dcf7..9d0359f 100644 --- a/style.css +++ b/style.css @@ -19,6 +19,7 @@ body { padding: 20px; position: relative; overflow-x: hidden; + cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 6 Q15 4 18 6 Q21 8 18 11 Q15 14 12 11 Q9 14 6 11 Q3 8 6 6 Q9 4 12 6 Z' fill='%23ff0000'/%3E%3Crect x='9' y='11' width='6' height='5' rx='1' fill='%23ff0000'/%3E%3Cpath d='M9 16 Q7 17 9 18 Q10 17 9 16 M15 16 Q17 17 15 18 Q14 17 15 16' fill='%23ff0000'/%3E%3Ccircle cx='10' cy='9' r='1.5' fill='%23ffffff'/%3E%3Ccircle cx='14' cy='9' r='1.5' fill='%23ffffff'/%3E%3Ccircle cx='10' cy='9' r='0.8' fill='%23000000'/%3E%3Ccircle cx='14' cy='9' r='0.8' fill='%23000000'/%3E%3C/svg%3E") 12 12, auto; } body::before { @@ -143,6 +144,7 @@ body::after { height: 100%; z-index: 1000; overflow: hidden; + cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 6 Q15 4 18 6 Q21 8 18 11 Q15 14 12 11 Q9 14 6 11 Q3 8 6 6 Q9 4 12 6 Z' fill='%23ff0000'/%3E%3Crect x='9' y='11' width='6' height='5' rx='1' fill='%23ff0000'/%3E%3Cpath d='M9 16 Q7 17 9 18 Q10 17 9 16 M15 16 Q17 17 15 18 Q14 17 15 16' fill='%23ff0000'/%3E%3Ccircle cx='10' cy='9' r='1.5' fill='%23ffffff'/%3E%3Ccircle cx='14' cy='9' r='1.5' fill='%23ffffff'/%3E%3Ccircle cx='10' cy='9' r='0.8' fill='%23000000'/%3E%3Ccircle cx='14' cy='9' r='0.8' fill='%23000000'/%3E%3C/svg%3E") 12 12, auto; } /* === CANVAS ARRIERE-PLAN MENU === */