View Full Version : [AS3] game wall

12-31-2011, 10:47 PM
hey readers,
i m a beginner
please i need your help
i m making packman game and i create walls in a movie clip .So how i able my walls (when packman strikes the packman was stop and not passes the wall)

instance name
wall movie clip = wall
packman movieclip = packman

01-01-2012, 04:12 AM

Did you search the forum first? There are at least 5 pac-man threads, some with this exact question. Briefly, the way to do pac-man closest to the original is to use a 2d array for the board instead of hittesting. See:


- dialectric

01-01-2012, 11:50 PM
hey there was any thread of as3 for packman which is useful for me

01-02-2012, 01:13 AM
You have got to check for collision. Look at hitTestObject()

01-03-2012, 07:55 PM
hey ,
every body

m making packman game so i having problem in walls

walls e.g
____ _______________
| ____| |
| _____ ______ |
| | | |
_____ ______ |
| | | |
| ______ |
|_____________ |____|

so the instance name is wall


so this is not working
help plz

01-03-2012, 08:07 PM
Here's how pacman actually does it.

You are actually on a grid, a specific position in the grid has four possible directions to head (up, down, left, right). The spot in the grid has assigned which paths are open, and which are closed (closed means there's a wall there).

Then all you do is check where pacman is located in the grid, and then in which direction the player is trying to go (forward if the directional is not being held), and if that direction in that tile of the grid is open (up down left right), then you can continue... otherwise stop.

When drawing this you just go through each tile and draw the appropriate edges for each tile using any number of methods.

Note this method actually allows for mono-directional openings. Say tile 3,3 allows you to go right, but 4,3 does NOT allow you to go left... the effect will appear on screen like a mono-directional doorway. You can then draw a special edge here to let the player know.

01-04-2012, 01:22 AM
I don't think that was how the original game was implemented. But your method is definitively valid.

01-04-2012, 01:13 PM
I'm fairly certain that's how the original pacman did it. The values for which directions were closed took up only 2 bits of information, and in hacked levels of the game you can see this via how turning is implemented in an open area restricting you still to just a tile grid (no diagonal or nothing).