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

#1 2010-10-04 23:49:45

AeroX2
New Scratcher
Registered: 2010-08-21
Posts: 4

Pacman Ghosts

Hello

I was wondering how to make a pacman ghost follow pacman I have tried using my script but no matter how I change it, it always ends up with the same result, stuck in a wall.

If you can offer some help it would be greatly appreciated.

Offline

 

#2 2010-10-05 20:43:39

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Pacman Ghosts

Anything like that is a bit tricky to make, and there's no easy solution. What does your script look like?


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2010-10-05 20:46:27

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Pacman Ghosts

I've read something about the real pacman ghost AI works, I think it checks each spot around them to see which is closest to pacman, and then move that way.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#4 2010-10-05 21:32:27

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: Pacman Ghosts

use a point to (Pacman) and a direction system.

That's what I would do.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#5 2010-10-06 14:53:55

colorfusion
Scratcher
Registered: 2009-10-03
Posts: 500+

Re: Pacman Ghosts

It completely depends on how you game is set out.
Could you upload it? Trying to make a script for something we have not seen is almost impossible.
Also "My script" does not really tell us anything about what does not work.

Offline

 

#6 2010-10-08 02:56:41

AeroX2
New Scratcher
Registered: 2010-08-21
Posts: 4

Re: Pacman Ghosts

http://img822.imageshack.us/img822/3141/capturecjz.jpg

The problem is the pacman is like behind a wall and the ghost keeps smashing into the wall. I need help to find out how to make it go around the wall

Offline

 

#7 2010-10-09 07:39:17

werdna123
Scratcher
Registered: 2010-06-12
Posts: 1000+

Re: Pacman Ghosts

ScratchReallyROCKS wrote:

I've read something about the real pacman ghost AI works, I think it checks each spot around them to see which is closest to pacman, and then move that way.

I think this is the only way but it could be hard  sad . If you can't get that to work try downloading another pacman and see how they do it!  smile

Offline

 

#8 2010-10-09 18:02:42

AeroX2
New Scratcher
Registered: 2010-08-21
Posts: 4

Re: Pacman Ghosts

Ive had a look at other pacman scripts but they all are just a line of ifs which makes it very confusing and hard to understand

Offline

 

#9 2010-10-09 19:23:23

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Pacman Ghosts

AeroX2 wrote:

Ive had a look at other pacman scripts but they all are just a line of ifs which makes it very confusing and hard to understand

Well, that's what the AI is, and why they're not exactly simple enough for us to give any definite answer. You just need an if block for every condition, and what it should do in that situation.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#10 2010-10-09 21:41:56

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Pacman Ghosts

It is really difficult to make a project go through a maze towards a specific point. It took me quite a while to figure out how to do it (several months, in fact), but I was able to concoct a simple Pathing AI: http://scratch.mit.edu/projects/coolstuff/1034493

However, giving it a "personality" like the Pacman ghosts could be really difficult... I wouldn't recommend it to anyone with anything short of, well, a lot of experience.

Offline

 

#11 2010-10-09 23:33:41

AeroX2
New Scratcher
Registered: 2010-08-21
Posts: 4

Re: Pacman Ghosts

I think ill ask around to see if I can borrow one. Its probably more simple that way.

Offline

 

#12 2010-10-10 00:45:18

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Pacman Ghosts

Well, when Prism releases the pacman we are doing, you will see. We have a seamless ai system.  big_smile


Hai.

Offline

 

#13 2010-12-23 08:55:46

skeletonxf
Scratcher
Registered: 2010-11-02
Posts: 10

Re: Pacman Ghosts

To make any ghost chase pacman, you make them continualy check if their y or x position equals pacmans y or x position, this checks if they are in a line with pacman, you then put a point twords pacman. If they "see" pacman they will chase him untill they lose sight of him.

Offline

 

#14 2010-12-30 14:05:15

surge1441
New Scratcher
Registered: 2010-10-24
Posts: 8

Re: Pacman Ghosts

I have to see the script first  smile

Offline

 

#15 2010-12-31 13:59:53

paperninjamaster
Scratcher
Registered: 2010-08-23
Posts: 40

Re: Pacman Ghosts

I Infact Is Making A Pacman Simulater. So I Could Help You by giving you my script after its finshed.

Last edited by paperninjamaster (2010-12-31 14:01:33)


This is a message to new Scratchers
Just keep on Scratching  smile

Offline

 

#16 2011-01-02 19:46:26

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Pacman Ghosts

ScratchReallyROCKS wrote:

I've read something about the real pacman ghost AI works, I think it checks each spot around them to see which is closest to pacman, and then move that way.

To read about the AI of each ghost, go here.

I once tried to make a Pac-man game with Scratch but gave up because I was frustrated and bored, and it was running slowly.  However, I have successfully created a Pacman game with my brother using Javascript; yes, I mean javascript to those of you who think it is impossible to make games with it  wink .

Also, the ghosts don't use any pathfinding AI.  They simply go in the cardinal direction that seems most direct to get to where they're going, so they sometimes take the long-way around to get somewhere.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer