I don’t know much of the actual workings behind the game, but I know each ghost has a bit of its own personality in how it chases the player.
I think the best way to do this is just to find a YouTube video on how the ghosts work. Pac-Man is a very popular game, so I’m sure there are some high-quality videos detailing how the ghosts work.
After that, you should get an idea of how the “follow” logic for the ghosts was coded. That should point you in the right direction and then you should be able to ask questions here in more detail. Right now it’s quite vague and it’s hard to help when the question is basically the entire ghost and not a specific quality of it.
This should be of some use to you. You’ll want to adjust the system so that the Arrows snap to 90-degree angles. At the start of the game you’ll want to do a simple Ray Cast check of which direction the Arrow cannot face so that if it tries to point that way, it will go in the next closest direction.