Workshop › Pac-Man-style Maze Chase › Step 28 of 42
Cyan takes the point 2 tiles ahead of you and doubles the arrow from red to that point. When red is behind you, cyan's target lands in front of you: together they close in from both sides.
```js
if (g.name === 'cyan') {
// Double the arrow from the red ghost to two tiles ahead of the player: it cuts the player off from the other side.
const red = ghosts[0]
return { col: 2 * (player.col + player.dir[0] * 2) - red.col, row: 2 * (player.row + player.dir[1] * 2) - red.row }
}
```A two tiles ahead of the player and R the red ghost, the arrow from R to A is A - R; doubling it from R
gives R + 2 × (A - R), which is 2 × A - R.In target, under the orange block, write the cyan block.
Skills: Game states
← Orange is shy Wait for the first key →