Advertisement
Guest User

Untitled

a guest
Apr 29th, 2011
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         private function build(level:Class):void {
  2.             var sprite:ArcSprite = new ArcSprite(0, 0, level);
  3.             var levelp:BitmapData = sprite.pixels;
  4.             for (i = 0; i < BLOCKS_H; i++) {
  5.                 for (j = 0; j < BLOCKS_W; j++) {
  6.                     var pixel:uint = levelp.getPixel(j, i);
  7.                     if (pixel == 0xaaaaaa) continue;
  8.                     addBlock(j, i, pixel);
  9.                 }
  10.             }
  11.         }
  12.        
  13.         private function addBlock(X:int, Y:int, P:uint):void {
  14.             var c:Class;
  15.             var tile:Tile;
  16.            
  17.             switch(P) {
  18.                 case 0xff0000:
  19.                     tile = new Block(X, Y, Color.RED);
  20.                 break;
  21.                 case 0x0084ff:
  22.                     tile = new Block(X, Y, Color.BLUE);
  23.                 break;
  24.             }
  25.            
  26.             if (tile == null) return;
  27.             this.add(tile);
  28.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement