Help With Pac-Man Ghost AI

I’m working on a Pac-Man game. I need to make it so the ghosts are relatively smart. In short I want an AI that changes directions when it bumps into a wall, and doesn’t just continously run into walls back and forth. I tried making one with one of the ghosts but it didn’t work out very well. Any help?

Also, there are many different object types used as walls. Is there any way to group them all as one so I don’t have to add a billion things for collision?

1 Like

I have an idea, but it’s relatively complicated. I’m well known for my work in A.I., so I might be a good person to work with for this. Are you okay with a lot of work?

I’m not the best flowlab coder, but I’m not terrible. Sure thing!

I would use raycast and several prximities

Wait hold on I have a different idea of where to go with my game. I don’t need help with this.

@“Biscuit Butter” in order to solve the collision issue you mentioned, create a single object type called “Barrier” or something, then make all your walls have that object as their parent. The just check for collisions against “Barrier” objects, and the children will all match.

Wait… thats a thing!!!

How did I not know that, that would make so many things easier

@grazer thanks! I always knew about parent objects existing just not what they did.

Parents are a great shortcut - keep in mind that the child objects inherit all the parents’ behaviors as well, so any logic the parent has, the child also has.

1 Like