Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make ghosts chase Pacman
- MihirSK
-
3 posts
How to make ghosts chase Pacman
Currently, the ghosts are going in random directions. Can someone just guide as to how I can make them reach Pacman. I tried to make them glide, but they just cross over the walls and glide towards Pacman.
Thanks
https://scratch.mit.edu/projects/113790537/
Thanks
https://scratch.mit.edu/projects/113790537/
- alexphan
-
1000+ posts
How to make ghosts chase Pacman
It looks like you made two topics containing similar things…?
- QuickSilver_18
-
97 posts
How to make ghosts chase Pacman
You could try using this block
Hope this helps
forever
go to [Pacman]
end
Hope this helps
- bcstahlman13
-
100+ posts
How to make ghosts chase Pacman
Hey MihirSK. I'm not a really experienced Scratcher, but I though I'd try to help with this issue. It seems to me that, at any time, a ghost may change either its x or y position, or occasionally both. (It can move either left and right, or up and down, depending on the location of the nearest wall) You'll have to create some logic to test which directions it can move. If it can change its x position without running into a wall, change its x position to more like pacman's. Similarly, if it can change its y position with hitting a wall, change its y position to be more like pacman's. You probably won't be able to use just a go to, or move towards pacman solution, because they will cause the ghost to move diagonally (and go through a wall). Let me know if this helps. Good luck and happy Scratching!
- bcstahlman13
-
100+ posts
How to make ghosts chase Pacman
Basically, you just have to change either the x or y position of the sprite, but not both at once. It's up to you how you want to handle it when you can choose either.
- ERS0606
-
1 post
How to make ghosts chase Pacman
I can't figure out how to do it !!!!!!!!!!!!!!!!!!!!!!!!!!!
- gtoal
-
1000+ posts
How to make ghosts chase Pacman
https://web.archive.org/web/20150212054502/http://pacman.shaunew.com/play/index.htm
click on the ‘learn’ button. it shows how the ghosts work…
click on the ‘learn’ button. it shows how the ghosts work…
- gamemakerboy123
-
1 post
How to make ghosts chase Pacman
this didn't work……. You could try using this blockforever
go to [Pacman]
end
Hope this helps
- 904509
-
1 post
How to make ghosts chase Pacman
Thank you for speaking about net nuetrality, but I don't think this is the time and place for that. It looks like you made two topics containing similar things…?
Anyway, I don't know how to do that snazzy thing when you have blocks in your comments, but here is how you can make pacman move.
Forever go to pacman take 3 steps. And then, add another one that says forever if not yellow touching blue, take 3 steps. Hope this helps!
- CodeNinja23
-
7 posts
How to make ghosts chase Pacman
If your talking about putting on the ghost script, does not work… the character is on top of Pac Man 24/7.Thank you for speaking about net nuetrality, but I don't think this is the time and place for that. It looks like you made two topics containing similar things…?
Anyway, I don't know how to do that snazzy thing when you have blocks in your comments, but here is how you can make pacman move.
Forever go to pacman take 3 steps. And then, add another one that says forever if not yellow touching blue, take 3 steps. Hope this helps!

- Despicable_Dad
-
500+ posts
How to make ghosts chase Pacman
Firstly, only let the ghost make a decision when it arrives at a junction in the maze. Then have the ghost take a few steps down each of the possible routes in turn. Each time, record the distance to pacman from that position, before returning to the junction. Finally, decide which route to go down based on which gave the shortest distance.
- Discussion Forums
- » Help with Scripts
-
» How to make ghosts chase Pacman