# Tile editor for flash based games?

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.

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

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.

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?