The code below is from a tile based game tutorial I found. For some reason, it doesn’t work in MX 2004. It only works in MX. Which lines are outdated?
fscommand ( "allowscale", false );
myMap = [ [1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,1],
[1,0,1,0,0,0,0,1],
[1,0,0,0,0,1,0,1],
[1,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1] ];
tileW = 16;
tileH = 16;
function buildMap (map) {
var mapWidth = map[0].length;
var mapHeight = map.length;
for (var i = 0; i<mapHeight; ++i) {
for (var j = 0; j<mapWidth; ++j) {
this.attachMovie("tile", "t_"+i+"_"+j, ++d);
this["t_"+i+"_"+j]._x = (j*tileW);
this["t_"+i+"_"+j]._y = (i*tileH);
this["t_"+i+"_"+j].gotoAndStop(map*[j]+1);
}
}
}
buildMap (myMap);