I have been writing a tile based game, but now that I'm almost done, I realise I have forgotten someting. The game is easy to understand. You have a player ( a red square) and you have the floor, and some balls witch you can push to get to the exit. It is alwas a 2d view (like super mario), but the player is a tile itself; The tiles swtich from empty to hero, back to empty (I hope you understand).

I'm dutch (that also explains my bad writing), but I think my game only contains english words. If not, i'm sorry.

The code:
Code:
stop();
game = {};
game.column = 10;
game.row = 10;
game.depth = 200;
game.space = 25;
game.level = {};
game.level.numberOfGoals = 0;
game.level.pasedGoals = 0;
hero = {};
hero.right = true;
hero.left = true;
ball = {};
myMap1 = [];
myMap1 = [[3, 3, 3, 3, 3, 3, 3, 3, 3, 3], 
		   [3, 3, 3, 3, 3, 3, 3, 3, 3, 3], 
		   [3, 3, 3, 3, 3, 3, 3, 3, 3, 3], 
		   [3, 3, 3, 3, 3, 3, 3, 3, 3, 3], 
		   [1, 4, 1, 1, 1, 1, 1, 1, 1, 1], 
		   [2, 4, 1, 4, 1, 1, 4, 1, 1, 6], 
		   [3, 3, 1, 3, 1, 3, 3, 1, 3, 3], 
		   [3, 3, 1, 3, 3, 3, 3, 1, 3, 3],
		   [3, 3, 3, 3, 3, 3, 3, 1, 3, 3], 
		   [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]];
for (i=0; i<game.column; i++) {
	for (j=0; j<game.row; j++) {
		name = "c"+i+"_"+j;
		_root.attachMovie("cell", name, game.depth++);
		ob = _root[name];
		ob._x = i*game.space;
		ob._y = j*game.space;
		ob.type = myMap1[j][i];
		if (ob.type == 2) {
			hero.x = i;
			hero.y = j;
		}
		ob.gotoAndStop(ob.type);
		if (ob.type == 4) {
			ball.x = i;
			ball.y = j;
		}
		if (ob.type == 6) {
			game.level.numberOfGoals++;
		}
	}
}

// *****************

function moveHero(dir) {
	if (dir == "right") {
		cell = "c"+hero.x+"_"+hero.y;
		ob = _root[cell];
		fCell = "c"+[hero.x+1]+"_"+hero.y;
		obF = _root[fCell];
		if (obF.type == 1 || obF.type == 5 || obF.type == 6) {
			if (myMap1[hero.y][hero.x] != 4 && myMap1[hero.y][hero.x] != 2 && myMap1[hero.y][hero.x] != 6) {
				ob.type = myMap1[hero.y][hero.x];
			} else {
				ob.type = 1;
			}
			ob.gotoAndStop(ob.type);
			hero.x++;
			obF.type = 2;
			obF.gotoAndStop(obF.type);
			if (myMap1[hero.y][hero.x] == 6) {
				game.level.pasedGoals++;
			}
		}
	}
	if (obF.type == 4) {
		Cell = "c"+[hero.x+1]+"_"+hero.y;
		ob = _root[Cell];
		fCell = "c"+[hero.x+2]+"_"+hero.y;
		obF = _root[fCell];
		if (obF.type == 1) {
			ball.x = hero.x+2;
			ball.y = hero.y;
			obF.type = 4;
			ob.type = 1;
			obF.gotoAndStop(obF.type);
			ob.gotoAndStop(ob.type);
		}
	}
	if (dir == "left") {
		cell = "c"+hero.x+"_"+hero.y;
		ob = _root[cell];
		fCell = "c"+[hero.x-1]+"_"+hero.y;
		obF = _root[fCell];
		if (obF.type == 1 || obF.type == 5 || obF.type == 6) {
			if (myMap1[hero.y][hero.x] != 4 && myMap1[hero.y][hero.x] != 2 && myMap1[hero.y][hero.x] != 6) {
				ob.type = myMap1[hero.y][hero.x];
			} else {
				ob.type = 1;
				if (myMap1[hero.y][hero.x] == 6) {
					game.level.pasedGoals++;
				}
			}
			ob.gotoAndStop(ob.type);
			hero.x--;
			obF.type = 2;
			obF.gotoAndStop(obF.type);
		}
		if (obF.type == 4) {
			Cell = "c"+[hero.x-1]+"_"+hero.y;
			ob = _root[Cell];
			fCell = "c"+[hero.x-2]+"_"+hero.y;
			obF = _root[fCell];
			if (obF.type == 1) {
				ball.x = hero.x-2;
				ball.y = hero.y;
				obF.type = 4;
				ob.type = 1;
				obF.gotoAndStop(obF.type);
				ob.gotoAndStop(ob.type);
			}
	         }
         }
}


// *******************

function checkForObjGrav() {
	cell = "c"+ball.x+"_"+ball.y;
	ob = _root[cell];
	fCell = "c"+ball.x+"_"+[ball.y+1];
	obF = _root[fCell];
	if (obF.type == 1) {
		obF.type = 4;
		ob.type = 1;
		obF.gotoAndStop(obF.type);
		ob.gotoAndStop(ob.type);
		ball.y++;
	}
}
The problem
As you can see, there is always a ball.x and a ball.y, but I forgot that there could be multiple balls. I have no idea how to make it work for more then 1 ball.

If some one could help me? (or atleast send me in the right direction).

Thx in advance!