[common] breakable bricks
This commit is contained in:
@@ -91,6 +91,7 @@ class Render extends SpriteView implements IRender {
|
||||
layersForUpdate[upLayer] = true;
|
||||
}
|
||||
}
|
||||
layersForUpdate[groundLayer] = true; //ToDo:
|
||||
for (entry in game.entities) {
|
||||
if (!states.exists(entry.key)) {
|
||||
states[entry.key] = new EntityState();
|
||||
@@ -137,7 +138,6 @@ class Render extends SpriteView implements IRender {
|
||||
g = upLayer.graphics;
|
||||
}
|
||||
if (g != null) {
|
||||
g.beginFill(0x00ff00);
|
||||
g.beginBitmapFill(Assets.getBitmapData('resources/images/map/map_${brick.config.type}.png'));
|
||||
g.drawRect(
|
||||
brick.cellX * game.map.cellWidth,
|
||||
@@ -145,6 +145,19 @@ class Render extends SpriteView implements IRender {
|
||||
game.map.cellWidth,
|
||||
game.map.cellHeight
|
||||
);
|
||||
if (brick.config.breakable) {
|
||||
for (point in brick.breaked.keys()) {
|
||||
if (brick.breaked.get(point)) {
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
g.endFill();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user