Jump to content


Photo

How to make Pacman?


  • Please log in to reply
4 replies to this topic

#1 cng

cng

    Young Padawan

  • Members
  • Pip
  • 55 posts

Posted 06 April 2005 - 12:05 AM

I am currently making the Pacman game on Flash for a school project. I need to know how to do the following things:

How to use Hit-Test for:
Pacman to stop at wall
Make dot disappear when Pacman "hits" it
- at the same time, change the variable text when that happens
Make 1 life disappear when ghost hits Pacman
Reset the position of the characters without resetting dots, life or score.

How to make variable text, how to make ghost have "AI" and if anyone has made this game before or has any suggestions on how to improve or change how things should be done, please tell me. I am new to Hit-tests and so I need the whole 411 on it. Thanks.

#2 CoryMathews

CoryMathews

    P2L Jedi

  • Members
  • PipPipPip
  • 554 posts
  • Gender:Male
  • Location:Texas

Posted 06 April 2005 - 12:13 AM

put this code on Pacman to stop him at a wall
change Name to the name of the wall mc
if (this.hitTest(_root.Name)) {

Make dot disappear when Pacman "hits" it
once again use the hit test but on the dot this time. make it say
also make a frame 2 in the dot mc and make it balnk

if (this.hitTest(_root.pacman)) {
_root.gotoAndStop(2);
s1=1;
score+=s1;
}

Make 1 life disappear when ghost hits Pacman
Reset the position of the characters without resetting dots, life or score.
put this hittest on the ghost

if (this.hitTest(_root.pacman)) {
life-=s1;
pacman._x = (where ever you want the x cord to be)
pacman._y = (where ever you want the y cord to be)
}

i think there is pacman already made check flashkit.com under movies.
if you need a more indepth desc feel free to ask.

#3 cng

cng

    Young Padawan

  • Members
  • Pip
  • 55 posts

Posted 06 April 2005 - 12:24 AM

Ok, thanks a lot. This game will already be quite impressive. However, I do want a little challenge by the Ghosts moving - following Pacman... I dont know how to:

Set speed, set controls to control Pacman, when you press the button to make Pacman go, how to play the movie clip of his mouth moving and on release of button, stop mouth. I also need some explaination of where the instance's names go and what to name things. Other than that, it was already great help. I need help knowing the basics of:

Hit-test
Buttons (for control)
Co-ordinates
and Speed...

#4 CoryMathews

CoryMathews

    P2L Jedi

  • Members
  • PipPipPip
  • 554 posts
  • Gender:Male
  • Location:Texas

Posted 06 April 2005 - 08:39 AM

ok on your pacman movieclip put this action this will make him move

onClipEvent (load) {
Speed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += Speed;
} else if (Key.isDown(Key.LEFT)) {
this._x -= Speed; }
if (Key.isDown(Key.DOWN)) {
this._y += Speed;
} else if (Key.isDown(Key.UP)) {
this._y -= Speed;

That will make you move. change where it says speed = 10 to chage how fast you move. but only one problem he doesnt stop for anything. so now do change it to this

onClipEvent (load) {
Speed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if (this.hitTest(_root.wall)) {
} else {
this._x += Speed; }
} else if (Key.isDown(Key.LEFT)) {
if (this.hitTest(_root.wall)) {
} else {
this._x -= Speed; }
if (Key.isDown(Key.DOWN)) {
if (this.hitTest(_root.wall)) {
} else {
this._y += Speed;}
} else if (Key.isDown(Key.UP)) {
if (this.hitTest(_root.wall)) {
} else {
this._y -= Speed; }
}

now you have your wall mc click on it and look at the properties bar. it shouldhave a dropdown box that says movieclip and then right below that it says <instance name> click on that and type wall.

#5 cng

cng

    Young Padawan

  • Members
  • Pip
  • 55 posts

Posted 07 April 2005 - 12:11 AM

I dont know - I think I did everything right but it doesnt work. I have checked out the source fla files of Pacman from Flashkit and those are too hard to take apart and examine piece by piece. I dont think they did the hit test or what ever nor do I think they set up the dots one by one... Can you maybe look into it and see if you can help figure out how to do this? BTW - there are two Pacman movie fla and both uses same technique so I think its safe to say - thats the best way to do it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users