View Full Version : [AS3] game wall
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)
wall movie clip = wall
packman movieclip = packman
01-01-2012, 05: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:
hey there was any thread of as3 for packman which is useful for me
You have got to check for collision. Look at hitTestObject()
m making packman game so i having problem in walls
| ____| |
| _____ ______ |
| | | |
_____ ______ |
| | | |
| ______ |
so the instance name is wall
so this is not working
01-03-2012, 09: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, 02:22 AM
I don't think that was how the original game was implemented. But your method is definitively valid.
01-04-2012, 02: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).
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.