floooh / pacman.c

Simple Pacman clone written in C99.
MIT License
508 stars 44 forks source link

Ghost can move UP where they should not be able to #2

Closed armin-reichert closed 3 years ago

armin-reichert commented 3 years ago

There are four tiles in the maze where ghosts (who are not dead) cannot move UP thus providing Pac-Man a safe place. This seems not to be implemented.

floooh commented 3 years ago

Ah alright! I missed this in the Pacman dossier. Those "red zones" actually explain why Blinky is behaving differently at the start of a round. In my version he's heading upwards at the first intersection to reach his scatter target, but he's actually forbidden to do that on the arcade machine and instead takes the long way around. I'll add those exceptions to the code today.

armin-reichert commented 3 years ago

In my understanding, the ghosts can travel at these four tiles upwards only when they are dead ("eyes"). This feature is important because it allows Pac-Man to take a safe place under certain conditions.

floooh commented 3 years ago

In the Pacman Dossier the two "red zones" (one right above the ghost house, and one in Pacman's starting row) are explained like this:

The two red zones represent the areas where ghosts are forbidden to make upward turns. Once a ghost enters either of these two zones, it may only travel from right-to-left or left-to-right until exiting the area. Thus, only Pac-Man has access to these four, upward-facing tunnel entrances.

This makes it sound like ghosts are generally forbidden to move upwards (and this also explains Blinky's behaviour at the start of a round), I have implemented it like explained in the Dossier now, and this fixes Blinky's starting behaviour, it's the same as in the emulator now.

floooh commented 3 years ago

(I actually need to add an exception for dead ghosts now...)

floooh commented 3 years ago

Ok exception added, also need to update the WASM version...

floooh commented 3 years ago

...ok WASM version updated.