I was wondering how in a pacman game, how do you make it so the ghosts come o an end and choose a random path to move down. I'm not actually making this, I was just curious, so you don't really need to write out a 10 page script. I just need a broad description, or a long one if you want.
Offline
when gf clicked forever if <touching [wall v]?> set [direction choosing v] to <pick random [1] to [4]> if <<direction choosing>=[1]> point in direction [0] end if <<direction choosing>=[2]> point in direction [90] end if <<direction choosing>=[3]> point in direction [180] end if <<direction choosing>=[4]> point in direction [-90] end endIt's not the most efficient way, but it will work. It will go in direction 90, or -90, or 0, or 180. If there's a wall there it will just do it again.
Offline
I once toyed around with Pacman and Scratch. I basically stored all of the intersection's x and y positions and what directions their respective walls were in, and then chose out of those walls. More mathematical than MaxFlyboy but his way works just as well (probably actually a lighter work-load).
You might be interested to know that the "real" Pacman isn't random. Each ghost follows very specific rules.
Offline
MoreGamesNow wrote:
I once toyed around with Pacman and Scratch. I basically stored all of the intersection's x and y positions and what directions their respective walls were in, and then chose out of those walls. More mathematical than MaxFlyboy but his way works just as well (probably actually a lighter work-load).
You might be interested to know that the "real" Pacman isn't random. Each ghost follows very specific rules.
Except for Clide. Clide's is perfectly random. I wonder why... He's always been the dullest knife in that drawer, hasn't he?
Offline
Actually, even Clide follows rules.
Offline