Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function build(level:Class):void {
- var sprite:ArcSprite = new ArcSprite(0, 0, level);
- var levelp:BitmapData = sprite.pixels;
- for (i = 0; i < BLOCKS_H; i++) {
- for (j = 0; j < BLOCKS_W; j++) {
- var pixel:uint = levelp.getPixel(j, i);
- if (pixel == 0xaaaaaa) continue;
- addBlock(j, i, pixel);
- }
- }
- }
- private function addBlock(X:int, Y:int, P:uint):void {
- var c:Class;
- var tile:Tile;
- switch(P) {
- case 0xff0000:
- tile = new Block(X, Y, Color.RED);
- break;
- case 0x0084ff:
- tile = new Block(X, Y, Color.BLUE);
- break;
- }
- if (tile == null) return;
- this.add(tile);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement