Init
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
export class TowerMap {
|
||||
#prnt;
|
||||
#prnt: HTMLElement;
|
||||
#tileset: string;
|
||||
|
||||
constructor(prnt: HTMLElement) {
|
||||
this.#prnt = prnt;
|
||||
this.#prnt.style.display = 'grid';
|
||||
}
|
||||
|
||||
draw() {
|
||||
this.#prnt.style.backgroundImage = 'url("images/land1.svg")';
|
||||
this.#prnt.style.gridTemplateColumns = 'repeat(20, 1ft)';
|
||||
this.#prnt.style.gridTemplateRows = 'repeat(20, 1ft)';
|
||||
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")`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user