class coordinates { #x; #y; #z; #rotate; constructor() { this.#x = 0; this.#y = 0; this.#z = 0; this.#rotate = 0; } get x() { return this.#x; } get y() { return this.#y; } get z() { return this.#z; } get rotate() { return this.#rotate; } set x(target) { if (typeof(target) !== "number") { throw new TypeError("Coordinate must be numer."); } this.#x = target; } set y(target) { if (typeof(target) !== "number") { throw new TypeError("Coordinate must be numer."); } this.#y = target; } set z(target) { if (typeof(target) !== "number") { throw new TypeError("Coordinate must be numer."); } this.#z = target; } set rotate(target) { if (typeof(target) !== "number") { throw new TypeError("Coordinate must be numer."); } this.#rotate = target % 360; } #radians(change = 0) { return (this.rotate + change) * Math.PI / 180; } move_front(target = 1) { if (typeof(target) !== "number") { throw new TypeError("Steps must be number."); } this.#y += Math.sin(this.#radians()) * target; this.#x += Math.cos(this.#radians()) * target; } move_back(target = 1) { if (typeof(target) !== "number") { throw new TypeError("Steps must be number."); } this.move_front(-target); } move_left(target = 1) { if (typeof(target) !== "number") { throw new TypeError("Steps must be number."); } this.#y += Math.sin(this.#radians(-90)) * target; this.#x += Math.cos(this.#radians(-90)) * target; } move_right(target = 1) { if (typeof(target) !== "number") { throw new TypeError("Steps must be number."); } this.move_left(-target); } rotate_clockwise(target = 0) { if (typeof(target) !== "number") { throw new TypeError("Degrees must be number."); } this.#rotate -= target; } rotate_counterclockwise(target = 0) { if (typeof(target) !== "number") { throw new TypeError("Degrees must be number."); } this.#rotate += target; } } export { coordinates };