This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-07-18 04:20:18

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Pacman

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.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#2 2007-07-18 10:32:00

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

Please tell me


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#3 2007-07-18 20:52:12

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Pacman

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)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#4 2007-07-19 03:24:39

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Pacman

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.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#5 2007-07-19 09:15:01

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

Thanks, Mayhem and archmage.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#6 2007-07-20 01:55:14

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

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.  sad

Last edited by Greatdane (2007-07-20 01:55:42)


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#7 2007-07-20 04:06:53

bigB
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: Pacman

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.


http://scratch.mit.edu/projects/bigB/260981 Draw to Text
http://scratch.mit.edu/projects/bigB/181829 3D Stunt Flyer

Offline

 

#8 2007-07-20 06:54:35

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

Thanks bigB.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#9 2007-07-20 11:54:18

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Pacman

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


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#10 2007-08-21 16:38:42

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

I have finally figured out how to move the ghosts!
<when green flag clicked><point towards(<if><direction><(  <=>  )><point in direction(

[/blocks]


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#11 2007-08-21 16:39:44

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

Oh my!


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#12 2007-08-21 16:41:46

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

[blocks]<when green flag clicked><forever><point towards(pacman)<if><direction><(  <=>  )><point in direction(


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#13 2007-08-21 16:45:24

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

[blocks]<when green flag clicked><forever><point towards(<if><(<direction><=>45 )><point in direction(90


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#14 2007-08-21 16:48:03

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

[blocks]<when green flag clicked>
<forever>
<point towards(
<if><direction><( <=>  )>
<point in direction(


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#15 2007-08-21 16:51:09

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

[blocks]<when green flag clicked>
<forever><point towards( pacman )
<if><(<direction>  <=> 45 )>
<point in direction( 90 ) [/blocks]


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#16 2007-08-21 16:52:49

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

No use.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#17 2007-08-21 17:01:17

paulmedwal
Scratcher
Registered: 2007-03-09
Posts: 100+

Re: Pacman

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)


clutter.scratch.mit.edu Visit the Clutter site to create multi-scene stories and multi-level games with Scratch.

Offline

 

#18 2007-08-21 17:12:26

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

[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]


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#19 2007-08-21 17:17:22

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

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.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#20 2007-08-21 17:22:47

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

I looked at archmages first link and then i have all the personalities made up.


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#21 2009-12-07 17:42:54

J147
Scratcher
Registered: 2009-12-07
Posts: 1

Re: Pacman

Thanks, great info - I'm trying to create a Pacman forum on the backend of my mum's website

http://www.dentistry-world.com

Offline

 

#22 2009-12-07 18:42:45

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Pacman

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  big_smile  , 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  big_smile


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#23 2009-12-07 18:50:19

samurai768
Scratcher
Registered: 2009-07-21
Posts: 1000+

Re: Pacman

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

 

#24 2009-12-07 20:24:10

Greatdane
Scratcher
Registered: 2007-06-05
Posts: 1000+

Re: Pacman

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.com

Please 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!


The future belongs to those who believe in the beauty of their dreams.
        ~ Eleanor Roosevelt

Offline

 

#25 2009-12-07 20:37:14

cocoanut
Scratcher
Registered: 2007-07-10
Posts: 1000+

Re: Pacman

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....


http://i42.tinypic.com/20gyvif.jpgPlease leave a message at the beep.
Steam: Hellephant

Offline

 

Board footer