I don't think the grid behavior works too well for a Pac-Man game, since the sprite would only be able to move from grid space to grid space. That would be especially annoying if you were using it for the player sprite itself.
I'm pretty sure there are many other ways to do the same thing, it's just the one that came to my mind. If somebody had a very simple solution I'd like to see that too.
Anyway, I found one bug in my latest example. Has to do with the starting position of ghosts which can create infinite loops right on startup (my first example didn't have that bug). I've fixed this and added the ability for ghosts to handle a dead end (to turn around, this would have caused a infinite loop in both older examples).
Also I've turned it into something a little different. Right now you can only draw your level, place ghosts and then run it to see what happens. I know it's far from a complete Pac-Man game yet. But I believe this could be really cool with features like being able to load different tile/sprite sets and save/load created levels of course. I'm currently thinking about turning this into a little side project of mine.
No source for this sry, but maybe it's still interesting: DOWNLOAD
[quote:22wev2cc]I m going to decrypt this code line by line until i understand the way you came to this.
That's a very good attitude right there. Once you get the hang of it you'll come up with your own (better?) solution.