Files
tower/js/layered_tile.js

26 lines
821 B
JavaScript
Raw Normal View History

2021-05-11 02:57:17 +00:00
import { Tile } from './tile.js';
export class LayeredTile extends Tile {
constructor(width, height, tiles) {
super(width, height);
2021-05-11 03:12:32 +00:00
this.tiles = [];
2021-05-11 02:57:17 +00:00
this.elem.style.position = 'relative';
for (let i = 0; i < tiles.length; i++) {
const tile = tiles[i];
2021-05-11 03:12:32 +00:00
this.tiles.push(tile);
const child = tile.get_elem();
this.elem.appendChild(child);
child.style.width = '100%';
child.style.height = '100%';
child.style.position = 'absolute';
child.style.top = '0';
child.style.left = '0';
child.style.zIndex = `${i}`;
}
}
play(name) {
for (const tile of this.tiles) {
tile.play(name);
2021-05-11 02:57:17 +00:00
}
}
}
//# sourceMappingURL=layered_tile.js.map