vitesse fantome parfait chasse ameliorer et logo souri chyanger en fantome
This commit is contained in:
38
game.js
38
game.js
@ -354,7 +354,7 @@ class Pacman {
|
|||||||
cherryEatenTimer = Math.max(150, 300 - (level - 1) * 20);
|
cherryEatenTimer = Math.max(150, 300 - (level - 1) * 20);
|
||||||
|
|
||||||
// Rendre tous les fantômes vulnérables
|
// 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) {
|
for (let ghost of ghosts) {
|
||||||
ghost.isVulnerable = true;
|
ghost.isVulnerable = true;
|
||||||
ghost.vulnerableTimer = vulnerableTime;
|
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++;
|
this.moveCounter++;
|
||||||
|
|
||||||
@ -555,15 +555,20 @@ class Ghost {
|
|||||||
// Fuir le joueur quand vulnérable
|
// Fuir le joueur quand vulnérable
|
||||||
this.direction = this.getDirectionAwayFromPacman(possibleDirections);
|
this.direction = this.getDirectionAwayFromPacman(possibleDirections);
|
||||||
} else {
|
} else {
|
||||||
// Comportement selon le type
|
// Tous les fantômes chassent le joueur (sauf patrouilleurs qui patrouillent si très loin)
|
||||||
if (this.type === GHOST_HUNTER) {
|
if (this.type === GHOST_PATROL) {
|
||||||
this.direction = this.getDirectionToPacman(possibleDirections);
|
const distance = Math.sqrt(
|
||||||
} else if (this.type === GHOST_PATROL) {
|
Math.pow(pacman.x - this.x, 2) +
|
||||||
this.direction = this.getPatrolDirection(possibleDirections);
|
Math.pow(pacman.y - this.y, 2)
|
||||||
} else if (this.type === GHOST_FAST || this.type === GHOST_INVISIBLE) {
|
);
|
||||||
this.direction = this.getDirectionToPacman(possibleDirections);
|
// 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 {
|
} else {
|
||||||
// Normal : toujours poursuivre
|
// Tous les autres chassent directement
|
||||||
this.direction = this.getDirectionToPacman(possibleDirections);
|
this.direction = this.getDirectionToPacman(possibleDirections);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -595,10 +600,13 @@ class Ghost {
|
|||||||
let targetX = pacman.x;
|
let targetX = pacman.x;
|
||||||
let targetY = pacman.y;
|
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
|
// Si Pacman bouge, prédire où il sera
|
||||||
if (pacman.direction !== undefined) {
|
if (pacman.direction !== undefined) {
|
||||||
const futureX = pacman.x + dx[pacman.direction] * 2;
|
const futureX = pacman.x + dx[pacman.direction] * predictionSteps;
|
||||||
const futureY = pacman.y + dy[pacman.direction] * 2;
|
const futureY = pacman.y + dy[pacman.direction] * predictionSteps;
|
||||||
if (futureX >= 0 && futureX < COLS && futureY >= 0 && futureY < ROWS) {
|
if (futureX >= 0 && futureX < COLS && futureY >= 0 && futureY < ROWS) {
|
||||||
targetX = futureX;
|
targetX = futureX;
|
||||||
targetY = futureY;
|
targetY = futureY;
|
||||||
@ -612,10 +620,8 @@ class Ghost {
|
|||||||
const oppositeDirection = (this.direction + 2) % 4;
|
const oppositeDirection = (this.direction + 2) % 4;
|
||||||
|
|
||||||
for (let dir of possibleDirections) {
|
for (let dir of possibleDirections) {
|
||||||
// Éviter la direction opposée sauf si c'est la seule option
|
// Permettre le retour en arrière si c'est la meilleure direction
|
||||||
if (possibleDirections.length > 1 && dir === oppositeDirection) {
|
// (pas de restriction pour une poursuite plus agressive)
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const nextX = this.x + dx[dir];
|
const nextX = this.x + dx[dir];
|
||||||
const nextY = this.y + dy[dir];
|
const nextY = this.y + dy[dir];
|
||||||
|
|||||||
@ -19,6 +19,7 @@ body {
|
|||||||
padding: 20px;
|
padding: 20px;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow-x: hidden;
|
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 {
|
body::before {
|
||||||
@ -143,6 +144,7 @@ body::after {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
overflow: hidden;
|
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 === */
|
/* === CANVAS ARRIERE-PLAN MENU === */
|
||||||
|
|||||||
Reference in New Issue
Block a user