Files
tower/ts/tower_map.ts
Ian Gulliver f3dee2adf0 Init
2021-05-08 20:30:37 +00:00

24 lines
551 B
TypeScript

export class TowerMap {
#prnt: HTMLElement;
#tileset: string;
constructor(prnt: HTMLElement) {
this.#prnt = prnt;
this.#prnt.style.display = 'grid';
}
set_size(x: number, y: number) {
this.#prnt.style.gridTemplateColumns = `repeat(${x}, 1fr)`;
this.#prnt.style.gridTemplateRows = `repeat(${y}, 1fr)`;
}
set_tileset(set: string) {
this.#tileset = set;
this.#prnt.style.backgroundImage = this.get_url('land');
}
private get_url(tile: string) {
return `url("images/${this.#tileset}/${tile}.svg")`;
}
}