PDA

View Full Version : pacman help


nhlrocker
11-08-2007, 08:43 AM
ok so i have the walls, animated pacman, the pellets, the menu, and everything. all i need is for pacman to eat the pellets (make them disapear) someone plzzz help, it is sooo close to being done!!!

fla.
http://www.megaupload.com/?d=A09PYW2W

Alexus
11-08-2007, 11:04 AM
Can't download the file.
So try to catch the event when pacman is close to the pellet. Make a trace when it is close.
Then just remove pellet clip from the scene.
Good Luck!

jefgibso
11-08-2007, 02:34 PM
Hi,

I went to the link but I don't see the download.

Quick question: Eating each item results in points correct?

Anyway, without seeing the fla I'm going to guess here... What I would do is have some code on each pellet that detects a hit from your pacman object (movieclip I assume). For example you might have something on the pellet enterFrame that says something like:

if (this.hitTest(_root.pacman)){
_root.scorevar++;
this.removeMovieClip();
}

Just an idea, if you give me the fla I can zero in on it ;)

nhlrocker
11-08-2007, 06:27 PM
kk i got the fla. in a zip.
plz help me!!! :)

Lucidity
11-08-2007, 07:10 PM
A hit test on the pellets should do it. Just if pac-man hits the pellet, remove it and add some points.

nhlrocker
11-08-2007, 08:52 PM
im totally noob at flash so yea i really need help lol
oh and im not doing the points so i just need somebody to animate him eating the pellets and the pellets disappearing

dialectric
08-16-2008, 03:28 PM
Using hit tests in a pacman game, it will be hard to create the feel of the original game. For Pacman, a 2d array is the preferred alternative, and has been discussed in a number of other threads including:
http://www.actionscript.org/forums/showthread.php3?t=134720

For the animation, I've seen a number of pac man games just use a 4 keyframe animation of the mouth stepping from open to closed, no tweening - take a look at flashkit for a few *.fla source examples.

-dialectric

The_Master_G3org3
08-16-2008, 04:52 PM
you need to do the pellets individualy and change them from a graphic to a movieclip i reckon. for the score-ing, have a dynamic text field somewhere on the stage(bottom right) and in the var box type score then when you get the pellets working name the pellets var score and have something similar to .. if (this.hitTest(_root.pacman)){
_root.scorevar++;
this.removeMovieClip();
}

... hang on.

The_Master_G3org3
08-16-2008, 05:11 PM
Here you go, im not using actionscript just covering up the pills lol, so work out what i did...

dialectric
08-26-2008, 01:25 PM
For those interested in doing an accurate pac-man ghost AI, it can be difficult, as ghost movement is neither random nor a common method of AI, and each ghost behaves differently. I found a useful post on AtariAge.com by poster "Otoboke":

* Red ghost (Oikake): Input is Pac-Man's location. He doesn't consider which direction Pac-Man is going. He attempts to reduce the distance between himself and Pac-Man. He will turn in the direction that will immediately reduce whichever is GREATER of the horizontal distance or vertical distance between himself and Pac-Man. This usually has him tenaciously following Pac-Man, but will occasionally lead to a "stupid" choice (see illustration below).

* Pink ghost (Machibuse): Input is four tiles in front of Pac-Man. Therefore direction Pac-Man is facing as well as actual location of Pac-Man determine Pinky's "target." Pinky attempts to home in on this target using the same logic as the Red ghost uses to home in on Pac-Man. This does indeed effectively "set up an ambush" if Pinky manages to get in front of you. At close range, the direction you face can mean life or death. If you're facing away from Pinky, he will chase you (his "target" is now in front of both you and him). If you face him or turn off to a side, he may turn away from you if that provides a shorter route to the target than running through you. Note that if the space four tiles in front of you is on the other side of a wall, he will go over there in preference to the side you are on.

* Blue ghost (Kimagure): Inputs, as mentioned, are the square two tiles in front of Pac-Man, and the location of the Red ghost. (Edited out incorrect information here and replaced with correct information that follows-->) To envision Inky's target, draw a line from the Red ghost to the spot 2 tiles in front of Pac-Man. Now extend that line twice as far in the same direction and draw an "x" where it winds up. Inky wants to reach that "x." The fact that Inky's AI has two inputs instead of one makes his behavior more complex. On a fast-moving playing field with Pac-Man and the red ghost constantly changing position, that "x" can be jumping all over the place and sometimes Inky's behavior seems completely random - but it's not. No wonder his alternate name on the Puck-Man rom is "Stylist"! His regular name, Kimagure ("Whimsy") is also appropriate. It makes sense that the closer the red ghost is to Pac-Man (technically, the closer he is to the spot two spaces in front of Pac-Man), the more predictable Inky's behavior appears. Thanks to JamieVegas and Dav for getting this right the first time. Sorry I temporarily had completely wrong information on here!

* Orange ghost (Otoboke): Has two modes, "near" (within 8 tiles of Pac-Man) and "far" (farther away than 8 tiles). In "far" mode, he heads toward Pac-Man using Blinky's logic. This gets him in the same general area of the maze, but then in "near" mode, he has a bizarre change of heart and decides to head for his corner of the maze (lower left island). Unless you happen to be in the lower left region, his about-face will soon take him into "far" mode again, and he will circle back toward your area. If you are in the lower left, he will circle his favorite island indefinitely. He will usually only "chase" you if you happen to be in the path between him and the lower left of the screen. Orange's "far" mode rarely leaves him doubled up on top of Red due to the fact that their home quadrants are on opposite sides of the map and "scatter" mode repeatedly separates them. Plus, red is usually close enough to you that orange will go into "near" mode if he gets close to red.

(from http://www.atariage.com/forums/index.php?showtopic=68707&st=25)

- dialectric