Workshop › Pac-Man-style Maze Chase › Step 36 of 42
Eating a power pellet now calls frighten. Every frame scaredFor counts down, and when it reaches 0 no ghost is
scared any more.
```js
if (powers.delete(here)) {
score += 50
frighten()
}
clock += 1
if (scaredFor > 0) {
scaredFor -= 1
if (scaredFor === 0) for (const g of ghosts) g.scared = false
}
```if becomes a block with braces, because it now does two things.arrive, turn the power pellet line into the block.update, under clock += 1, write the countdown.Skills: Game states
← Frighten the ghosts Scared ghosts wander slowly →