Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to make the age-old version of pacman. And only then that I realized that I need to spend a heck lot of time for making the tile matrix itself. It gets messy more and more.

I've also heard of this thing called level editors; Are there any of these kind for flash based games. If so, do write it down one line at a time. Thank You.

share|improve this question
    
Not to be annoying, but seriously - PACMAN wouldnt take an hour to write down in a Spreadsheet if your tiles are "visible". –  BerggreenDK Nov 14 '10 at 17:23
    
@BerggreenDK : can you explain,please? –  Vishnu Nov 16 '10 at 4:29
    
Did you see my answer yet? –  BerggreenDK Nov 20 '10 at 2:38
add comment

4 Answers

up vote 1 down vote accepted

First of all there are a bunch of tutorials on Google regarding building Pac-man clones in eg. Flash. Some of these explain the idea pretty well. There is also a site telling the story and ruleset of the original Pacman ghosts AI. Will see if I can find that link again someday.

But regarding your question.

First of all you need to know your "maximum size" of your levels. In PacMan (from now on "PM" only) the maze is of a certain size, but this wouldnt be too hard to change later though - its only for the principles.

A 2D maze can be implemented with ARRAY's 2 dimensional arrays are just large strings of data.

I will try to show it with characters here:

XXXXXXXXXX
X...X....X
X.X.X.XX.X
X.X...X..X
X.X.X.XX.X
X...X....X
XXXXXXXXXX

Now thats not a pretty reprecentation of the actual PM, but enough for my point. What I can do now is to store these within a simple array/list of strings.

As you havent told us what programming language you will be using, I will just try to use some "pseudo kinda description" (javascript/actionscript/C# kinda )

var maze string[10]; 

maze[0] = "XXXXXXXXXX";
maze[1] = "X...X....X";
maze[2] = "X.X.X.XX.X";
maze[3] = "X.X...X..X";
maze[4] = "X.X.X.XX.X";
maze[5] = "X...X....X";
maze[6] = "XXXXXXXXXX";

From this I can find out where the walls are. I can use this for collision detection, I can use it for pathfinding and I can use it to draw the actual map.

You just make a function that will return what kinda "tile" is on a certain coordinate.

tiletype GetTile(xcoord:int, ycoord:int)
{
   return substring(maze[ycoord], xcoord,1);    // returns a substring (string, starting at xcoord, length)
}

You could also make it more "specific" if you want.

boolean isWall(xcoord:int, ycoord:int)
{
   return (substring(maze[ycoord], xcoord,1) == "x") 
}

Does this make sense?

share|improve this answer
1  
Thankyou for your explanation.I'm marking your answer as correct. –  Vishnu Nov 20 '10 at 14:05
    
@Vish Great thanks, but keep asking if you have more questions. Game development and algorithm crushing is my favorite hobby. –  BerggreenDK Nov 20 '10 at 17:00
    
LOL! just found this link: thetoolsmiths.org/2009/02/24/sweating-the-small-stuff –  BerggreenDK Nov 21 '10 at 5:37
add comment
  • Tiled is a cross platform and quite powerful tile-editor.
  • Ogmo Editor is implemented in Flash (Adobe AIR), simple but good enough for most tasks.
share|improve this answer
    
actually i need a matrix out of the tiled representation, went through both of these and I could'nt get what I wanted. –  Vishnu Sep 21 '10 at 10:01
    
Not sure what you mean by that. Do you mean a matrix with tile-indices? Look at the output generated by OGMO Editor here: mattmakesgames.com/OgmoEditor/help/getting_started/index.html#4 looks like a nice matrix to me? –  bummzack Sep 21 '10 at 12:17
    
hey thanks, bummzack ! –  Vishnu Sep 23 '10 at 5:53
add comment

Mappy is another one. There's a plugin for mappy that exports maps in a format that is ready for flixel (a very well known game engine for Flash)

share|improve this answer
add comment

Dame- Deadly Alien Map Editor. Looks very slick, although I haven't tried it myself yet. It gets high ratings on the flixel boards.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.