react-simple-game-engine 0.2.130 → 0.2.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import Matter from "matter-js";
2
2
  import { Sprite } from "../sprites/sprite";
3
- import { CreateBodyDefine, EntityInitial, EntityPrepare, MasterBody, Point } from "../../export-types";
3
+ import { Color, CreateBodyDefine, EntityInitial, EntityPrepare, MasterBody, Point } from "../../export-types";
4
4
  import { EntitySult } from "./entity-sult";
5
5
  import { LogicComponent } from "../logic-component";
6
6
  import { Sound } from "../sound";
@@ -36,6 +36,7 @@ export declare abstract class Entity<P extends Record<string, any> = Record<stri
36
36
  private _props;
37
37
  private timerJobListeners;
38
38
  private isTerminate;
39
+ debugSensor: boolean;
39
40
  readonly sensors: Sensor[];
40
41
  enabledGravity: boolean;
41
42
  sound?: Sound;
@@ -67,7 +68,18 @@ export declare abstract class Entity<P extends Record<string, any> = Record<stri
67
68
  */
68
69
  onTimer(interval: number, job: TimerJobListener, { defaultRun, once, startFrom, onRegisterDone, }?: TimerOptions): () => void;
69
70
  removeSensor(sensor: Sensor): void;
70
- addSensor({ position, name, shape, width, height, radius, }: AddSensorParams): void;
71
+ /**
72
+ * @param {Point} position delta position of sensor base on entity position
73
+ * @param {string} name name of sensor
74
+ * @param {"rect"|"circle"} shape type of shape of physical body, ex: "rect"|"circle"
75
+ * @param {number} width width of sensor, apply when in "rect" shape
76
+ * @param {number} height height of sensor, apply when in "rect" shape
77
+ * @param {number} radius radius of sensor, apply when in "circle" shape
78
+ * @param {boolean} debug allow to show sensor for debug purpose
79
+ * @param {boolean} debugColor allow to change sensor color
80
+ * @void
81
+ */
82
+ addSensor({ position, name, shape, width, height, radius }: AddSensorParams, debug?: boolean, debugColor?: Color): void;
71
83
  createBody(enabledPhysicBody: boolean, transform: CreateBodyDefine["transform"], options?: CreateBodyDefine["bodyOptions"]): MasterBody | {
72
84
  position: Point;
73
85
  entity: Entity<Record<string, any>>;
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/entity.ts"],"names":[],"mappings":"AAAA,OAAO,MAAwB,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK,EAEN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,aAAK,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAEnC,aAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;CACjD,CAAC;AAEF,aAAK,YAAY,GAAG;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,aAAK,eAAe,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB,GAAG,CACA;IACE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,GACD;IACE,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MA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AAM,EAAE,MAAM,GAAG,MAAM;IAC5D,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAChE"}
@@ -47,6 +47,7 @@ var Entity = /** @class */ (function (_super) {
47
47
  _this._props = {};
48
48
  _this.timerJobListeners = [];
49
49
  _this.isTerminate = false;
50
+ _this.debugSensor = false;
50
51
  _this.sensors = [];
51
52
  _this.enabledGravity = true;
52
53
  return _this;
@@ -161,20 +162,32 @@ var Entity = /** @class */ (function (_super) {
161
162
  this.worldManagement.removeBody(sensor.body);
162
163
  }
163
164
  };
164
- Entity.prototype.addSensor = function (_a) {
165
+ /**
166
+ * @param {Point} position delta position of sensor base on entity position
167
+ * @param {string} name name of sensor
168
+ * @param {"rect"|"circle"} shape type of shape of physical body, ex: "rect"|"circle"
169
+ * @param {number} width width of sensor, apply when in "rect" shape
170
+ * @param {number} height height of sensor, apply when in "rect" shape
171
+ * @param {number} radius radius of sensor, apply when in "circle" shape
172
+ * @param {boolean} debug allow to show sensor for debug purpose
173
+ * @param {boolean} debugColor allow to change sensor color
174
+ * @void
175
+ */
176
+ Entity.prototype.addSensor = function (_a, debug, debugColor) {
165
177
  var position = _a.position, name = _a.name, _b = _a.shape, shape = _b === void 0 ? "rect" : _b, width = _a.width, height = _a.height, radius = _a.radius;
178
+ if (debug === void 0) { debug = false; }
166
179
  name = name || genId();
167
- var pos = position || __assign({}, this.position);
180
+ var pos = __assign({}, this.position);
168
181
  var sensor;
169
182
  if (shape === "rect") {
170
- sensor = new Sensor(this, name, { width: width, height: height }, shape, Bodies.rectangle(pos.x, pos.y, width, height, {
183
+ sensor = new Sensor(this, name, position || { x: 0, y: 0 }, { width: width, height: height }, shape, Bodies.rectangle(pos.x, pos.y, width, height, {
171
184
  isSensor: true,
172
- }));
185
+ }), debug, debugColor);
173
186
  }
174
187
  else {
175
- sensor = new Sensor(this, name, { width: radius * 2, height: radius * 2 }, shape, Bodies.circle(pos.x, pos.y, radius, {
188
+ sensor = new Sensor(this, name, position || { x: 0, y: 0 }, { width: radius * 2, height: radius * 2 }, shape, Bodies.circle(pos.x, pos.y, radius, {
176
189
  isSensor: true,
177
- }));
190
+ }), debug, debugColor);
178
191
  }
179
192
  this.sensors.push(sensor);
180
193
  this.worldManagement.addBody(sensor.body);
@@ -1,13 +1,14 @@
1
- import { Color, SensorBody, Size } from "../export-types";
1
+ import { Color, Point, SensorBody, Size } from "../export-types";
2
2
  import { Entity } from "./entities/entity";
3
3
  export declare class Sensor {
4
4
  readonly entity: Entity;
5
5
  readonly name: string;
6
+ readonly position: Point;
6
7
  readonly size: Size;
7
8
  readonly shape: "rect" | "circle";
8
9
  readonly body: SensorBody;
9
10
  readonly debug: boolean;
10
11
  readonly debugColor: Color;
11
- constructor(entity: Entity, name: string, size: Size, shape: "rect" | "circle", body: SensorBody, debug?: boolean, debugColor?: Color);
12
+ constructor(entity: Entity, name: string, position: Point, size: Size, shape: "rect" | "circle", body: SensorBody, debug?: boolean, debugColor?: Color);
12
13
  }
13
14
  //# sourceMappingURL=sensor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sensor.d.ts","sourceRoot":"","sources":["../../src/classes/sensor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,qBAAa,MAAM;aAEC,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;aACZ,IAAI,EAAE,IAAI;aACV,KAAK,EAAE,MAAM,GAAG,QAAQ;aACxB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,OAAO;aACd,UAAU,EAAE,KAAK;gBANjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,GAAG,QAAQ,EACxB,IAAI,EAAE,UAAU,EAChB,KAAK,GAAE,OAAe,EACtB,UAAU,GAAE,KAA4B;CAK3D"}
1
+ {"version":3,"file":"sensor.d.ts","sourceRoot":"","sources":["../../src/classes/sensor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,qBAAa,MAAM;aAEC,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;aACZ,QAAQ,EAAE,KAAK;aACf,IAAI,EAAE,IAAI;aACV,KAAK,EAAE,MAAM,GAAG,QAAQ;aACxB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,OAAO;aACd,UAAU,EAAE,KAAK;gBAPjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,KAAK,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,GAAG,QAAQ,EACxB,IAAI,EAAE,UAAU,EAChB,KAAK,GAAE,OAAe,EACtB,UAAU,GAAE,KAA4B;CAK3D"}
@@ -1,9 +1,10 @@
1
1
  var Sensor = /** @class */ (function () {
2
- function Sensor(entity, name, size, shape, body, debug, debugColor) {
2
+ function Sensor(entity, name, position, size, shape, body, debug, debugColor) {
3
3
  if (debug === void 0) { debug = false; }
4
4
  if (debugColor === void 0) { debugColor = [212, 200, 200, 100]; }
5
5
  this.entity = entity;
6
6
  this.name = name;
7
+ this.position = position;
7
8
  this.size = size;
8
9
  this.shape = shape;
9
10
  this.body = body;
@@ -1 +1 @@
1
- {"version":3,"file":"world-management.d.ts","sourceRoot":"","sources":["../../src/classes/world-management.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiB,IAAI,EAAE,MAAM,WAAW,CAAC;AAIxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,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AO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,qBAAa,eAAe;IAWd,OAAO,CAAC,OAAO;IAAgB,OAAO,CAAC,MAAM;IAVzD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;IAC/D,OAAO,CAAC,QAAQ,CAAC,YAAY,CAGtB;IACP,OAAO,CAAC,QAAQ,CAAC,YAAY,CACxB;IAEL,OAAO,CAAC,OAAO,CAAS;gBAEJ,OAAO,EAAE,YAAY,EAAU,MAAM,EAAE,KAAK;IAoDhE,OAAO,CAAC,mBAAmB;IAiB3B,IAAI,MAAM,WAET;IAED,IAAI,MAAM,iBAET;IAED,IAAI,KAAK,eAER;IAED,eAAe,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,SAAS,GAAG,IAAI;IAqB1E,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,OAAO;IAWf,UAAU;IAKV,sBAAsB,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAK3D,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM;IAKpD,kBAAkB;IAMlB,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EACzC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,CAAA;KAAE,GAC3B,CAAC;IAgBJ,OAAO,CAAC,IAAI,EAAE,IAAI;IAIlB,UAAU,CAAC,IAAI,EAAE,IAAI;IAIrB,SAAS,CAAC,MAAM,EAAE,UAAU;IAa5B,YAAY,CAAC,MAAM,EAAE,UAAU;IAoB/B,MAAM;IAiBN,IAAI;CAmBL"}
@@ -194,9 +194,13 @@ var WorldManagement = /** @class */ (function () {
194
194
  this.iterateEntities(function (entity) {
195
195
  entity.update();
196
196
  if (entity instanceof Entity) {
197
- for (var _i = 0, _a = entity.sensors; _i < _a.length; _i++) {
198
- var sensor = _a[_i];
199
- Body.setPosition(sensor.body, entity.position);
197
+ var _a = entity.position, entityX = _a.x, entityY = _a.y;
198
+ for (var _i = 0, _b = entity.sensors; _i < _b.length; _i++) {
199
+ var _c = _b[_i], body = _c.body, position = _c.position;
200
+ Body.setPosition(body, {
201
+ x: entityX + position.x,
202
+ y: entityY + position.y,
203
+ });
200
204
  }
201
205
  }
202
206
  });
@@ -205,18 +209,20 @@ var WorldManagement = /** @class */ (function () {
205
209
  this.iterateEntities(function (entity) {
206
210
  entity.draw();
207
211
  if (entity instanceof Entity) {
208
- var _loop_1 = function (sensor) {
209
- if (sensor.debug) {
210
- var _b = sensor.size, width_1 = _b.width, height_1 = _b.height;
211
- Renderer.drawHandle(sensor.body.position, function (renderer) {
212
- renderer.fill(sensor.debugColor);
213
- renderer.rect(0, 0, width_1, height_1);
214
- });
212
+ if (entity.debugSensor) {
213
+ var _loop_1 = function (sensor) {
214
+ if (sensor.debug) {
215
+ var _b = sensor.size, width_1 = _b.width, height_1 = _b.height;
216
+ Renderer.drawHandle(sensor.body.position, function (renderer) {
217
+ renderer.fill(sensor.debugColor);
218
+ renderer.rect(0, 0, width_1, height_1);
219
+ });
220
+ }
221
+ };
222
+ for (var _i = 0, _a = entity.sensors; _i < _a.length; _i++) {
223
+ var sensor = _a[_i];
224
+ _loop_1(sensor);
215
225
  }
216
- };
217
- for (var _i = 0, _a = entity.sensors; _i < _a.length; _i++) {
218
- var sensor = _a[_i];
219
- _loop_1(sensor);
220
226
  }
221
227
  }
222
228
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-game-engine",
3
- "version": "0.2.130",
3
+ "version": "0.2.132",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib",