UNPKG

@erikyuzwa/rogue-punk

Version:

a JavaScript library to help you build your roguelike adventures

39 lines (38 loc) 821 B
import { Vector3d } from './Vector3d'; import { Emitter } from './Emitter'; export class Entity extends Emitter { constructor(options) { super(options); this.position = new 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(x, y, z); if (this.map) { this.map.updateEntityPosition(this, oldPosition); } } setMap(map) { this.map = map; } render(display) { } }