Easiest thing to do:
Bismapdata.draw();
Useful. Hint: Scaling matrix.
AS3:
//Create minimap BMD
var minimap:BitmapData = new BitmapData(200, 200, true, 0);
//Create the holder
var bmp:Bitmap = new Bitmap(minimap);
//Attach it
stage.addChild(bmp);
//If you have a level MC (some display object containing JUST terrain), replace stage
//Make sure you don't include the minimap itself in the draw (hence it attaching to stage, not root)
//You'll have to do more translating + scaling with the matrix to make it fit right if 0,0 isn't top left
var target = root;
function renderMap() {
//Set scales
sX = minimap.width/target.width;
sY = minimap.height/target.height;
//Preserve square-minimap scaling
sX = sX > sY ? sY : sX;
sY = sY > sX ? sX : sY;
//Create draw matrix
var scale:Matrix = new Matrix();
//Scale matrix
scale.scale(sX, sY);
//Clear minimap + fill with a transparent color (makes it easier to see edges of minimap)
minimap.fillRect(minimap.rect, 0x33000000);
//Draw new minimap, using scale values
minimap.draw(target, scale);
}
//Set an interval to re-render minimap every 30ms (= to 30fps, 1fps = 1000ms/f, 30fps = 30ms/f)
setInterval(renderMap, 30);
"Give a man a match, and he'll be warm for a minute, but set him on fire, and he'll be warm for the rest of his life."