Tower class hierarchy

This commit is contained in:
Ian Gulliver
2021-05-11 02:57:17 +00:00
parent 495aeb6204
commit 0ff24fe806
28 changed files with 346 additions and 279 deletions

23
ts/layered_tile.ts Normal file
View File

@@ -0,0 +1,23 @@
import { Tile } from './tile.js';
export class LayeredTile extends Tile {
elem: HTMLElement;
constructor(width: number, height: number, tiles: Tile[]) {
super(width, height);
this.elem.style.position = 'relative';
for (let i = 0; i < tiles.length; i++) {
const tile = tiles[i];
const sub = tile.get_elem();
this.elem.appendChild(sub);
sub.style.width = '100%';
sub.style.height = '100%';
sub.style.position = 'absolute';
sub.style.top = '0';
sub.style.left = '0';
sub.style.zIndex = `${i}`;
}
}
}