Help With pac man ghosts

Hey does anyone have any good suggestions when making AI for a pac man game? me and my friend have been trying to make a ghost that either goes through the maze or even better follows the pac man? We have been trying to make this for a couple of days but have had no luck :confused:

heres a link to the game:
https://flowlab.io/game/view/1193330

For now just go to the second level for actual gameplay, first level is a tittle screen that isn’t finished

Making a ghost follow packman would be difficult (but not impossible), I would recommend doing something like this:

Have a randomizer chose a direction and use a ray cast to see of that direction is blocked, if it isn’t have the ghost move forward until it hits a crossroads, you can mark these with invisible blocks. When it does, chose a new random direction and repeat. If the first direction is blocked, make it so that the randomizer repeats and chooses a new direction. Or add one to the number, also changing the direction.

This should work, you might need to change some stuff if I got something wrong though.

I could also make a demo if you want.

Yes if you can its me the partner, could you please do a demo?

Ok, i’ll be finished with it sometime this afternoon probably

Here yah go

http://www.flowlab.io/game/play/1197242

I’ve done my best to make a good AI, it sometimes gets stuck on walls and reverses direction for unknown reasons, but 98% of the time it worked for me.

In order for this to work for multiple ghosts you will need the intersection block to send messages to each of the ghosts individually when they collide.

This was pretty difficult and I would love to see some flowlab experts try to make one of these.

I also tried importing it into your game, you’ll need to make a couple changes but their all pretty simple.

its working but the problem is that the dots are like a wall and is not muving

Have you tried making the dots not solid blocks?

just make all the ghosts with Clyde’s style code. like my_name (<_>) said