UNPKG

@erikyuzwa/rogue-punk

Version:

a JavaScript library to help you build your roguelike adventures

43 lines (42 loc) 979 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Entity = void 0; const Vector3d_1 = require("./Vector3d"); const Emitter_1 = require("./Emitter"); class Entity extends Emitter_1.Emitter { constructor(options) { super(options); this.position = new Vector3d_1.Vector3d(0, 0, 0); } get x() { return this.position.x; } set x(x) { this.position.x = x; } get y() { return this.position.y; } set y(y) { this.position.y = y; } get z() { return this.position.z; } set z(z) { this.position.z = z; } setPosition(x, y, z) { const oldPosition = this.position; this.position = new Vector3d_1.Vector3d(x, y, z); if (this.map) { this.map.updateEntityPosition(this, oldPosition); } } setMap(map) { this.map = map; } render(display) { } } exports.Entity = Entity;