I'm creating a view of isometric tiles using this simple nested loop:
const TILE_WIDTH:Number = 180;
const TILE_HEIGHT:Number = 90;
for( var i:Number = 0; i < 10; i++ ){
for( var j:Number = 0; j < 10; j++ ){
var tile:MovieClip = new TileMC(); // a movieclip in the library...
// with a different tile & label on each frame
tile.x = ( TILE_WIDTH / 2 ) * ( j - i );
tile.y = ( TILE_HEIGHT / 2 ) * ( j + i );
tile.gotoAndStop( mapTileLabelsAr[j][i] ); // a 2d array of strings
addChild( tile );
}
}
This arranges the tiles nicely but I need to rotate the map at 90 degree intervals. I don't need to move any tile's x,y positions (As that would screw up depth sorting), rather just select a different frame using the 2d array of label strings. How can I achieve that?