Prototype tower + projectile animation
This commit is contained in:
30
js/tile.js
30
js/tile.js
@@ -1,36 +1,18 @@
|
||||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to set private field on non-instance");
|
||||
}
|
||||
privateMap.set(receiver, value);
|
||||
return value;
|
||||
};
|
||||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
|
||||
if (!privateMap.has(receiver)) {
|
||||
throw new TypeError("attempted to get private field on non-instance");
|
||||
}
|
||||
return privateMap.get(receiver);
|
||||
};
|
||||
var _name, _width, _height;
|
||||
export class Tile {
|
||||
constructor(name, width, height) {
|
||||
_name.set(this, void 0);
|
||||
_width.set(this, void 0);
|
||||
_height.set(this, void 0);
|
||||
__classPrivateFieldSet(this, _name, name);
|
||||
__classPrivateFieldSet(this, _width, width);
|
||||
__classPrivateFieldSet(this, _height, height);
|
||||
this.name = name;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
get_elem(tileset) {
|
||||
const elem = document.createElement('div');
|
||||
elem.style.backgroundImage = `url("images/${tileset}/${__classPrivateFieldGet(this, _name)}.svg")`;
|
||||
elem.style.backgroundImage = `url("images/${tileset}/${this.name}.svg")`;
|
||||
elem.style.backgroundSize = 'cover';
|
||||
elem.style.gridColumnEnd = `span ${__classPrivateFieldGet(this, _width)}`;
|
||||
elem.style.gridRowEnd = `span ${__classPrivateFieldGet(this, _height)}`;
|
||||
elem.style.gridColumnEnd = `span ${this.width}`;
|
||||
elem.style.gridRowEnd = `span ${this.height}`;
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
_name = new WeakMap(), _width = new WeakMap(), _height = new WeakMap();
|
||||
/*
|
||||
function string_to_mask(mask_string: string): boolean[][] {
|
||||
// mask_string: '\n+++\n+++\n'
|
||||
|
||||
Reference in New Issue
Block a user