react-simple-game-engine 0.1.5 → 0.1.6
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.
@@ -3,7 +3,7 @@ import { Sprite } from "../sprites/sprite";
|
|
3
3
|
import { CreateBodyDefine, EntityInitial, EntityPrepare, MasterBody, Sound } from "../../export-types";
|
4
4
|
import { EntitySult } from "./entity-sult";
|
5
5
|
import { LogicComponent } from "../logic-component";
|
6
|
-
export declare abstract class Entity<SP extends Record<string, any> = Record<string, any>> extends EntitySult<EntityInitial<Entity
|
6
|
+
export declare abstract class Entity<SP extends Record<string, any> = Record<string, any>> extends EntitySult<EntityInitial<Entity>> {
|
7
7
|
private _body;
|
8
8
|
private _sprite;
|
9
9
|
private _children;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/entity.ts"],"names":[],"mappings":"AAAA,OAAO,
|
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,EACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,8BAAsB,MAAM,CAC1B,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACpD,SAAQ,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,SAAS,CAAoB;IAErC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var __rest = (this && this.__rest) || function (s, e) {
|
|
38
38
|
import { ColorSprite } from "../sprites/color.sprite";
|
39
39
|
import { EntitySult } from "./entity-sult";
|
40
40
|
import { copyProperties } from "../../utils";
|
41
|
-
//@ts-ignore
|
42
41
|
var Entity = /** @class */ (function (_super) {
|
43
42
|
__extends(Entity, _super);
|
44
43
|
function Entity() {
|
@@ -102,11 +101,10 @@ var Entity = /** @class */ (function (_super) {
|
|
102
101
|
Entity.prototype.initial = function (_a) {
|
103
102
|
var _b = _a.transform, transform = _b === void 0 ? {} : _b, spriteComponent = _a.sprite, bodyOptions = _a.bodyOptions, _c = _a.sceneProps, sceneProps = _c === void 0 ? {} : _c, params = __rest(_a, ["transform", "sprite", "bodyOptions", "sceneProps"]);
|
104
103
|
var _d = this.onInitial(), _e = _d.transform, _f = _e === void 0 ? {} : _e, _g = _f.x, x = _g === void 0 ? 0 : _g, _h = _f.y, y = _h === void 0 ? 0 : _h, dfTransform = __rest(_f, ["x", "y"]), dfBodyOptions = _d.bodyOptions, dfSpriteComponent = _d.sprite, _j = _d.sceneProps, dfSceneProps = _j === void 0 ? {} : _j, dfParams = __rest(_d, ["transform", "bodyOptions", "sprite", "sceneProps"]);
|
104
|
+
copyProperties(this.sceneProps, __assign(__assign({}, dfSceneProps), sceneProps));
|
105
105
|
var _k = this.onPrepare(), transformAlt = _k.transform, bodyOptionsAlt = _k.bodyOptions, spriteComponentAlt = _k.sprite, _l = _k.sceneProps, scenePropsAlt = _l === void 0 ? {} : _l, paramsAlt = __rest(_k, ["transform", "bodyOptions", "sprite", "sceneProps"]);
|
106
106
|
this.createBody(__assign(__assign(__assign({ x: x, y: y }, dfTransform), transform), transformAlt), __assign(__assign(__assign({}, dfBodyOptions), bodyOptions), bodyOptionsAlt));
|
107
|
-
|
108
|
-
copyProperties(this.sceneProps, _sceneProps);
|
109
|
-
copyProperties(this, _sceneProps);
|
107
|
+
copyProperties(this.sceneProps, __assign({}, scenePropsAlt));
|
110
108
|
copyProperties(this, __assign(__assign(__assign({}, dfParams), params), paramsAlt));
|
111
109
|
//@ts-ignore
|
112
110
|
this.sprite =
|
@@ -131,3 +129,26 @@ var Entity = /** @class */ (function (_super) {
|
|
131
129
|
return Entity;
|
132
130
|
}(EntitySult));
|
133
131
|
export { Entity };
|
132
|
+
// class Test extends Entity<{ test?: string }> {
|
133
|
+
// onSpriteWidthHeightBinding(): { width: number; height: number } {
|
134
|
+
// return {
|
135
|
+
// width: 2,
|
136
|
+
// height: 2,
|
137
|
+
// };
|
138
|
+
// }
|
139
|
+
// protected onInitial(): EntityInitial<this> {
|
140
|
+
// return {
|
141
|
+
// transform: {
|
142
|
+
// radius: 5,
|
143
|
+
// },
|
144
|
+
// };
|
145
|
+
// }
|
146
|
+
// protected onCreateBody(
|
147
|
+
// transform: CreateBodyDefine["transform"] & { radius: number },
|
148
|
+
// options?: CreateBodyDefine["bodyOptions"]
|
149
|
+
// ): Body {
|
150
|
+
// return Bodies.circle(transform.x!, transform.y!, transform.radius, options);
|
151
|
+
// }
|
152
|
+
// }
|
153
|
+
// const t = new Test();
|
154
|
+
// Test[]
|