[common] update map
This commit is contained in:
@@ -130,7 +130,7 @@ class Render extends SpriteView implements IRender {
|
||||
if (layersForUpdate[groundLayer] || layersForUpdate[upLayer]) {
|
||||
groundLayer.graphics.clear();
|
||||
upLayer.graphics.clear();
|
||||
for (brick in game.map.bricks) {
|
||||
for (brick in game.map.bricks) if (!brick.destroyed) {
|
||||
var g:Graphics = null;
|
||||
if (brick.config.layer < 3) {
|
||||
g = groundLayer.graphics;
|
||||
@@ -140,37 +140,47 @@ class Render extends SpriteView implements IRender {
|
||||
if (g != null) {
|
||||
g.beginBitmapFill(Assets.getBitmapData('resources/images/map/map_${brick.config.type}.png'));
|
||||
g.drawRect(
|
||||
brick.cellX * game.map.cellWidth,
|
||||
brick.cellY * game.map.cellHeight,
|
||||
game.map.cellWidth,
|
||||
game.map.cellHeight
|
||||
brick.rect.x,
|
||||
brick.rect.y,
|
||||
brick.rect.width,
|
||||
brick.rect.height
|
||||
);
|
||||
for (point in brick.cells.keys()) {
|
||||
if (brick.cells.get(point).destroyed) {
|
||||
for (cell in brick.cells.iterator()) {
|
||||
if (cell.destroyed) {
|
||||
g.beginFill(0x000000);
|
||||
g.drawRect(
|
||||
brick.cellX * game.map.cellWidth + point.x * game.map.cellWidth / 2,
|
||||
brick.cellY * game.map.cellHeight + point.y * game.map.cellHeight / 2,
|
||||
game.map.cellWidth / 2,
|
||||
game.map.cellHeight / 2
|
||||
cell.rect.x,
|
||||
cell.rect.y,
|
||||
cell.rect.width,
|
||||
cell.rect.height
|
||||
);
|
||||
}
|
||||
}
|
||||
g.endFill();
|
||||
}
|
||||
}
|
||||
|
||||
// Debug cells
|
||||
/*var g = groundLayer.graphics;
|
||||
for (c in game.map.grid.cells.iterator()) {
|
||||
var color:Int = 0x000000;
|
||||
if (c.armor > 0) {
|
||||
if (c.armor == 1) {
|
||||
color = 0xffcc00;
|
||||
} else if (c.armor > 1) {
|
||||
color = 0x606060;
|
||||
} else if (c.layer == 0) {
|
||||
color = 0xffff90;
|
||||
} else if (c.layer == 1) {
|
||||
color = 0x0000ff;
|
||||
}else if (c.layer > 1) {
|
||||
color = 0x00ff00;
|
||||
}
|
||||
g.beginFill(color);
|
||||
g.drawRect(c.rect.x, c.rect.y, c.rect.width, c.rect.height);
|
||||
g.endFill();
|
||||
}*/
|
||||
}
|
||||
layersForUpdate[groundLayer] = false;
|
||||
layersForUpdate[upLayer] = false;
|
||||
layersForUpdate[upLayer] = false;*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user