I'm working on making an exact recreation of pacman on scratch. Click the blue highleted text to see it at: http://scratch.mit.edu/projects/Greatdane/22457
I still need help on how to make the ghosts and move them.
Offline
The programming of the ghosts somewhat difficult and will require some effort.
Ill post some of the info I found on the web about programming pacman ghosts
Firstly you have to know that each ghost has a different way of tracking down pacman. From what I found on online forums this is how the ghosts work.
Blinky (Red) - He tries to get you by your relative position. He takes the fastest route to find you. I believe he tries to line up with you horizontally first, then vertically.
Pinky (Pink) - He wants to move in the same direction as you, but only when he's close enough to you. In other words, he tries to get to your area first, then when he's close enough, he will try to run in the same direction as you. This can be tested by running right up to him and when he gets right in front of you he will turn away (provided there is a hallway to turn into)
Clyde (Gold) - He seems to want to be in the same general area as you, but doesn't seem to directly chase you. Don't let this fool you; he will not turn away if you are in his path. If you stay in one area, he seems to have a set pattern.
Inky (Teal) - He's the tough one. The only thing I've been able to figure out about him is that he seems to be able to take on the personality of any of the other three at a given point in time.
Now to make the ghosts move correctly this is what you should do.
First make sure you put a forever move loop on the ghosts because they will be constantly moving.
Then make sprites called waypoints and place them at all the intersections where you would want the ghosts to turn at. The waypoints should probably be called w1,w2,w3 and so on. When one of the ghosts touches one of the way points it will rotate based on its general behavior and pacman's position. For example if pacman was to the left of a waypoint and a ghost touches that waypoint that ghost would point left making it move to where pacman is. You should make an even grid for your pacman game so that you can plan out where the walls and the waypoints are.
It is important that the ghosts are at the center of the waypoints before rotating the ghosts so before rotating the ghosts to avoid rotating into walls make it so the ghosts quickly glide to the waypoint they are touching before rotating them. (The glide to waypoint could also be used for pacman to avoid getting stuck in walls.)
Also when pacman eats a power pellet the ghosts should move in the opposite way they normally would and when the game starts the ghost should move to separate corners so not to gang up on pacman too early.
I didn't go into detail about the problems you might face because it would take up too much space. If you do use this method of programming pacman you will an authentic pacman game.
Last edited by archmage (2007-07-19 23:04:11)
Offline
An additional note about pac-man:
Don't use sprites for the dots!
It is far more efficient to paint the dots onto the maze and have pac-man detect their colour, add a point, then paint over them.
See any of my pacman experiments for examples (V5 is the most recent)
The only exception might be power-pills.
Offline
Mayhem, I'm sorry to say this, but your information is actually no use at all. That is EXACTLY what i did in my first pacman remodel. Sorry.
Last edited by Greatdane (2007-07-20 01:55:42)
Offline
Blinky - Chases. Will usually take the shortest route to you, and tends to follow.
Pinky - Ambushes. Tends to take a more roundabout way to pac-man. Deadly.
Inky - Freak. This dude acts strangely. He moves about the board fairly randomly, but sometimes chases when he gets in close.
Clyde - Idiot. Moves randomly. Not much of a threat.
this is how the ghosts move (archmage was very close) i got the info from this site.
http://www.everything2.com/index.pl?node_id=499157
You could use archmages' technigque with a sprite on every corner but that would come to a huge amount. i think the easiest way is to have an extra sprite that sets a variable when it is touching a wall. then you know if you are in a junction with less sprites. useing this you can use archmage's idea of having a forever loop that changes depending on the junction variables. you can view the script for my pacman if you wish. http://scratch.mit.edu/projects/bigB/15121
i have one thats priority is to have the same x coordinate as you, one that wants to have the same y as you mostly, one that is halfway between and one (the blue one) that is kind of random.
Offline
Here are some links that have information on the ghosts AI and will help you to recreate them acurately. Also most of the stuff I talked about is in these links.
http://jongy.tripod.com/GhostPsychology.html
http://www.atariage.com/forums/index.php?showtopic=68707
http://www.kirupa.com/forum/archive/index.php/t-43260.html
Offline
I have finally figured out how to move the ghosts!
<when green flag clicked><point towards(<if><direction><( <=> )><point in direction(
[/blocks]
Offline
testing...I just added some spaces to Greatdane's post below...
thanks for testing this out...
Paulmedwal
[blocks]
<when green flag clicked>
<forever>
<point towards( pacman
<if> << <( <direction> <>> 90 )> <and> <(<direction> <<> 180 )>
<point in direction( 90
<repeat until><(<{ stop }> <=> 1 )>
<move( 1 )steps>
<end>
<end>
<end>
[/blocks]
Last edited by paulmedwal (2007-08-21 17:26:26)
Offline
[blocks]<when green flag clicked>
<forever>
<point towards( pacman )
<if><<<(<direction><>>90)> <and><(<direction><<>180)>>>
<point in direction( 90 )
<repeat until><(<{stop}><=>1)>
<move( 1 )steps>
<end>
<end>
<end>
[/blocks]
Offline
That is my very best. Anyways, the ghost points towards pacman and detects what direction it is pointing. Then, based on that, it points in a direction (180,0,90,or -90)
and moves foward until a sprite-senesor sets a vairable to 1 and the ghost stops moving, therefore restarting the cylce again.
Offline
Clyde (Gold) - He seems to want to be in the same general area as you, but doesn't seem to directly chase you. Don't let this fool you; he will not turn away if you are in his path. If you stay in one area, he seems to have a set pattern.
I always thought of Clyde as orange
, and I thought he would be the random one.
P.S. Do you know why Clyde's name doesn't rhyme with the others'? It's because he is the best
Offline
J147 wrote:
Thanks, great info - I'm trying to create a Pacman forum on the backend of my mum's website
http://www.dentistry-world.com
Please don't bump up old topics, it seems that Greatdane already deleted his pacman game. Thanks, and Scratch On!
Offline
samurai768 wrote:
J147 wrote:
Thanks, great info - I'm trying to create a Pacman forum on the backend of my mum's website
http://www.dentistry-world.comPlease don't bump up old topics, it seems that Greatdane already deleted his pacman game. Thanks, and Scratch On!
"I haven't. Thanks and Scratch On!"
Don't do that. Just leave that to a moderator! It's annoying!
Offline
Greatdane wrote:
Don't do that. Just leave that to a moderator! It's annoying!
Elsewhere, cocoanut wrote:
I honestly disagree.
As a member of the Scratch community, I think we are empowered and encouraged to help monitor the site.
As MyRedNeptune stated:MyRedNeptune wrote:
Being a Forum moderator doesn't really add much to the help you can give to the Scratch community. The only thing is that moderators have more authority.
But you can offer great help to the community nonetheless and be respected for it as much as any moderator.I take that to mean you can do whatever a moderator does, however with the inability to edit and delete others' posts.
Also:relyt12101 wrote:
archmage wrote:
I think you may need more than 30 posts to be considered. Asking to be a mod probably won't do much anyways.
All the people who asked to moderators didn't become one. And, all the moderators were selected out by the Scratch Team.
Also --> You don't need to be a moderator to make Scratch a "safer, funner" place. You can do that now!The part I highlighted at the end signifies the importance of that quote. "You can do that now" indicates that, without being a forum moderator, you can help, which I take to mean, again: doing what moderators can do.
Here's a little something from mletreat:mletreat wrote:
Hey gang-
It's great to hear that you'd like to help make Scratch a better place for everyone. We encourage everyone in the Scratch community to help monitor the site. There are lots of ways that each person can help.
You can help others in the Scratch community find interesting and creative projects by adding tags, writing comments, answering & asking questions, and creating galleries.
Also, you all can help to make Scratch a friendlier place by flagging inappropriate projects and comments. We rely on the community to help us identify projects and comments that should be reviewed and/or removed.
Finally, you can inspire your peers by creating cool projects and sharing them!
With the help of each of you, we hope to keep Scratch a safe and fun place for everyone!Again, monitoring the site: What I take to mean helping out with spam, commercial advertisements, et cetera.
I hope that's enough to prove my point....
Please leave a message at the beep.Offline