Livl-Corporation / livl-pacman

Insane Pac-Man clone from © Livl Corporation 🕹️
MIT License
0 stars 1 forks source link

FRIGHTENED MODE #85

Closed FranckG28 closed 1 year ago

FranckG28 commented 1 year ago

Anytime Pac-Man eats one of the four energizers on the level, the ghosts reverse direction and, on earlier levels, go into frightened mode. Frightened ghosts turn dark blue and wander about the maze for a few moments, flashing briefly as a warning before returning to normal. Ghosts use a pseudo-random number generator (PRNG) to pick a way to turn at each intersection when frightened.

The PRNG generates an pseudo-random memory address to read the last few bits from. These bits are translated into the direction a frightened ghost must first try. If a wall blocks the chosen direction, the ghost then attempts the remaining directions in this order: up, left, down, and right, until a passable direction is found. The PRNG gets reset with an identical seed value every new level and every new life, causing predictable results.