I was reading tonypa’s tile based game tutorial and tried to translate it to as2 when I realized two things:
a. I don’t know/remember what the this[stuff]._property syntax means, I don’t recall seeing [] except in arrays. can someone explain/link to an explanation/name to so I’ll know what to look up.
b. I don’t know how to scoop my individual tiles. my code is the following:
class game{
var _tileW:Number;
var _tileH:Number;
var _mapColumns:Number;
var _mapRows:Number;
function game(tileH:Number, tileW:Number){
this._tileH = tileH;
this._tileW = tileW;
}
private function buildMap(map:Array){
var i;
var j;
var tag;
_root.createEmptyMovieClip("container", _root.getNextHighestDepth());
this._mapRows = map.length;
this._mapColumns = map[0].length;
for(i=0; i<_mapRows; i++){
for(j=0; j<_mapColumns; j++){
tag = "t_"+i+"_"+j;
_root.container.attachMovie("tile", tag, _root.getNextHighestDepth());
_root.container.tag._x = _tileW*j;
_root.container.tag._y = _tileH*i;
trace(_root.container[tag]._x);
}
}
}
}
obviously _root.container.tag. isn’t the way to get to the tile, so what is?
thanks in advance =)