Hi,
Here’s the code I’m using to blit character frame animations onto a bitmap…
I can get around 200 objects blitted to the bitmap before it starts to lag…
So… I’m just asking… Do you guys see anything I could tweak to get more performance out of it?
private function gameloop(e:Event):void{
gameboard.lock();
gameboard.fillRect(gameRect,0x000000);
for(var i:int=0;i<userobjects.length;i++){
var usb:Object = userobjects*;
var charState:String = "norm";
usb.framenum++;
if(int(usb.framenum)>int(bitinfo[usb.framestate+"_"+charState][4])){
usb.framenum = 1;
}
var image:BitmapData = bitmaps[usb.framestate+"_"+charState+"_"+usb.framenum];
var xx:int = usb.x;
var yy:int = usb.y;
var iwid:int = bitinfo[usb.framestate+"_"+charState][2]
var ihei:int = bitinfo[usb.framestate+"_"+charState][3]
gameboard.copyPixels(image,new Rectangle(0,0,iwid,ihei) ,new Point(xx,yy));
}
gameboard.unlock();
}
“gameboard” is the BitmapData that everything is blitted onto…
I’m storing all the bitmaps in an array (bitmaps)… with a string as the key…
The images that are blitted are around 70px by 140px.
Do you guys see anything that could be done better?