Workshop › Pac-Man-style Maze Chase › Step 38 of 42
Meeting a scared ghost is good news: it is eaten. You get chain points, and chain doubles for the next one (200,
400, 800, 1600). The ghost goes back into the house and waits 3 seconds before it comes out again, no longer scared.
```js
if (!g.scared) {
caught()
return
}
// A scared ghost is eaten: points, and back to the house for a while.
score += chain
chain *= 2
Object.assign(g, { col: 9, row: 9, dir: STOP, progress: 0, waiting: 180, scared: false })
```chain *= 2 doubles the value for the next ghost; frighten puts it back to 200.waiting: 180, so the countdown in update releases it later.In the catch loop of update, put caught(); return inside if (!g.scared) { ... } and write the eating lines under
it.
Skills: Collision detection, Game states
← Scared ghosts wander slowly Blue, then flashing →