react-simple-game-engine 0.1.59 → 0.1.62

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.
Files changed (83) hide show
  1. package/lib/utilities.d.ts +0 -1
  2. package/package.json +4 -2
  3. package/lib/classes/animations/animation.d.ts +0 -14
  4. package/lib/classes/animations/animation.d.ts.map +0 -1
  5. package/lib/classes/animations/animation.js +0 -35
  6. package/lib/classes/animations/avatar.animation.d.ts +0 -16
  7. package/lib/classes/animations/avatar.animation.d.ts.map +0 -1
  8. package/lib/classes/animations/avatar.animation.js +0 -45
  9. package/lib/classes/animations/color.animation.d.ts +0 -9
  10. package/lib/classes/animations/color.animation.d.ts.map +0 -1
  11. package/lib/classes/animations/color.animation.js +0 -33
  12. package/lib/classes/camera.d.ts.map +0 -1
  13. package/lib/classes/camera.js +0 -34
  14. package/lib/classes/entities/circle.entity.d.ts +0 -15
  15. package/lib/classes/entities/circle.entity.d.ts.map +0 -1
  16. package/lib/classes/entities/circle.entity.js +0 -55
  17. package/lib/classes/entities/entity-sult.d.ts +0 -34
  18. package/lib/classes/entities/entity-sult.d.ts.map +0 -1
  19. package/lib/classes/entities/entity-sult.js +0 -108
  20. package/lib/classes/entities/entity.d.ts +0 -55
  21. package/lib/classes/entities/entity.d.ts.map +0 -1
  22. package/lib/classes/entities/entity.js +0 -180
  23. package/lib/classes/entities/rect.entity.d.ts +0 -17
  24. package/lib/classes/entities/rect.entity.d.ts.map +0 -1
  25. package/lib/classes/entities/rect.entity.js +0 -56
  26. package/lib/classes/logic-component.d.ts.map +0 -1
  27. package/lib/classes/logic-component.js +0 -77
  28. package/lib/classes/p5.d.ts.map +0 -1
  29. package/lib/classes/p5.js +0 -58
  30. package/lib/classes/particle-system.d.ts.map +0 -1
  31. package/lib/classes/particle-system.js +0 -98
  32. package/lib/classes/particle.d.ts.map +0 -1
  33. package/lib/classes/particle.js +0 -117
  34. package/lib/classes/prefab.d.ts.map +0 -1
  35. package/lib/classes/prefab.js +0 -24
  36. package/lib/classes/saver.d.ts.map +0 -1
  37. package/lib/classes/saver.js +0 -33
  38. package/lib/classes/scene-management.d.ts.map +0 -1
  39. package/lib/classes/scene-management.js +0 -58
  40. package/lib/classes/scene.d.ts.map +0 -1
  41. package/lib/classes/scene.js +0 -433
  42. package/lib/classes/sound-watcher.d.ts.map +0 -1
  43. package/lib/classes/sound-watcher.js +0 -33
  44. package/lib/classes/sound.d.ts.map +0 -1
  45. package/lib/classes/sound.js +0 -119
  46. package/lib/classes/sprites/avatar.sprite.d.ts +0 -20
  47. package/lib/classes/sprites/avatar.sprite.d.ts.map +0 -1
  48. package/lib/classes/sprites/avatar.sprite.js +0 -89
  49. package/lib/classes/sprites/color.sprite.d.ts +0 -7
  50. package/lib/classes/sprites/color.sprite.d.ts.map +0 -1
  51. package/lib/classes/sprites/color.sprite.js +0 -40
  52. package/lib/classes/sprites/sprite.d.ts +0 -26
  53. package/lib/classes/sprites/sprite.d.ts.map +0 -1
  54. package/lib/classes/sprites/sprite.js +0 -70
  55. package/lib/classes/watcher.d.ts.map +0 -1
  56. package/lib/classes/watcher.js +0 -44
  57. package/lib/classes/world-management.d.ts.map +0 -1
  58. package/lib/classes/world-management.js +0 -160
  59. package/lib/decorators/scene-tag.decor.d.ts.map +0 -1
  60. package/lib/decorators/scene-tag.decor.js +0 -5
  61. package/lib/decorators/scene-ui.decor.d.ts.map +0 -1
  62. package/lib/decorators/scene-ui.decor.js +0 -5
  63. package/lib/decorators/sound-from.decor.d.ts.map +0 -1
  64. package/lib/decorators/sound-from.decor.js +0 -17
  65. package/lib/decorators/sprite-from.decor.d.ts.map +0 -1
  66. package/lib/decorators/sprite-from.decor.js +0 -13
  67. package/lib/export-enums.d.ts.map +0 -1
  68. package/lib/export-enums.js +0 -5
  69. package/lib/export-interfaces.d.ts.map +0 -1
  70. package/lib/export-interfaces.js +0 -1
  71. package/lib/export-types.d.ts.map +0 -1
  72. package/lib/export-types.js +0 -1
  73. package/lib/index.d.ts.map +0 -1
  74. package/lib/ui-components/SceneRunner.d.ts.map +0 -1
  75. package/lib/ui-components/SceneRunner.js +0 -43
  76. package/lib/ui-components/ScenesProcess.d.ts.map +0 -1
  77. package/lib/ui-components/ScenesProcess.js +0 -46
  78. package/lib/ui-components/Sketch.d.ts.map +0 -1
  79. package/lib/ui-components/Sketch.js +0 -33
  80. package/lib/utilities.d.ts.map +0 -1
  81. package/lib/utilities.js +0 -3
  82. package/lib/utils.d.ts.map +0 -1
  83. package/lib/utils.js +0 -97
@@ -1,180 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- var __rest = (this && this.__rest) || function (s, e) {
28
- var t = {};
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
- t[p] = s[p];
31
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
- t[p[i]] = s[p[i]];
35
- }
36
- return t;
37
- };
38
- import { Body } from "matter-js";
39
- import { ColorSprite } from "../sprites/color.sprite";
40
- import { EntitySult } from "./entity-sult";
41
- import { copyProperties } from "../../utils";
42
- var Entity = /** @class */ (function (_super) {
43
- __extends(Entity, _super);
44
- function Entity() {
45
- var _this = _super !== null && _super.apply(this, arguments) || this;
46
- _this._props = {};
47
- _this.timerJobListeners = [];
48
- _this.isTerminate = false;
49
- _this.enabledGravity = true;
50
- return _this;
51
- }
52
- Object.defineProperty(Entity.prototype, "sprite", {
53
- get: function () {
54
- return this._sprite;
55
- },
56
- set: function (sprite) {
57
- this._sprite = sprite;
58
- this._sprite.entity = this;
59
- },
60
- enumerable: false,
61
- configurable: true
62
- });
63
- Object.defineProperty(Entity.prototype, "position", {
64
- get: function () {
65
- return this._body.position;
66
- },
67
- enumerable: false,
68
- configurable: true
69
- });
70
- Object.defineProperty(Entity.prototype, "body", {
71
- get: function () {
72
- return this._body;
73
- },
74
- enumerable: false,
75
- configurable: true
76
- });
77
- Object.defineProperty(Entity.prototype, "props", {
78
- get: function () {
79
- return this._props;
80
- },
81
- enumerable: false,
82
- configurable: true
83
- });
84
- /**
85
- * @param {TerminateOptions} options
86
- * #duration: time to disappear from the world in seconds, default: 0.2 seconds
87
- * #effect: effect to showing on duration time
88
- * @void
89
- */
90
- Entity.prototype.terminate = function (options) {
91
- var _this = this;
92
- if (options) {
93
- var _a = options.duration, duration = _a === void 0 ? 0.2 : _a, effect = options.effect;
94
- this.isTerminate = true;
95
- Body.setVelocity(this.body, {
96
- y: 0,
97
- x: 0,
98
- });
99
- this.addChild(effect);
100
- setTimeout(function () {
101
- _this.worldManagement.removeEntity(_this);
102
- }, duration * 1000);
103
- }
104
- else {
105
- this.worldManagement.removeEntity(this);
106
- }
107
- };
108
- /**
109
- * @param {number} interval in seconds
110
- * @param {TimerJobListener} job function that run per #interval
111
- * @void
112
- */
113
- Entity.prototype.onTimer = function (interval, job, defaultRun) {
114
- var _this = this;
115
- if (defaultRun === void 0) { defaultRun = false; }
116
- var listener = {
117
- timeCounter: 0,
118
- interval: interval,
119
- job: job,
120
- defaultRun: defaultRun,
121
- };
122
- this.timerJobListeners.push(listener);
123
- return function () {
124
- var index = _this.timerJobListeners.indexOf(listener);
125
- if (index > -1) {
126
- _this.timerJobListeners.splice(index, 1);
127
- }
128
- };
129
- };
130
- Entity.prototype.createBody = function (transform, options) {
131
- this._body = this.onCreateBody(transform, options);
132
- this._body.entity = this;
133
- return this._body;
134
- };
135
- Entity.prototype.initial = function (_a) {
136
- var transform = _a.transform, spriteComponent = _a.sprite, bodyOptions = _a.bodyOptions, _b = _a.props, props = _b === void 0 ? {} : _b, params = __rest(_a, ["transform", "sprite", "bodyOptions", "props"]);
137
- var _c = this.onInitial(), _d = _c.transform, _e = _d === void 0 ? {} : _d, _f = _e.x, x = _f === void 0 ? 0 : _f, _g = _e.y, y = _g === void 0 ? 0 : _g, dfTransform = __rest(_e, ["x", "y"]), dfBodyOptions = _c.bodyOptions, dfSpriteComponent = _c.sprite, _h = _c.props, dfProps = _h === void 0 ? {} : _h, dfParams = __rest(_c, ["transform", "bodyOptions", "sprite", "props"]);
138
- copyProperties(this._props, __assign(__assign({}, dfProps), props));
139
- var _j = this.onPrepare(), transformAlt = _j.transform, bodyOptionsAlt = _j.bodyOptions, spriteComponentAlt = _j.sprite, _k = _j.props, propsAlt = _k === void 0 ? {} : _k, paramsAlt = __rest(_j, ["transform", "bodyOptions", "sprite", "props"]);
140
- this.createBody(__assign(__assign(__assign({ x: x, y: y }, dfTransform), transform), transformAlt), __assign(__assign(__assign({}, dfBodyOptions), bodyOptions), bodyOptionsAlt));
141
- copyProperties(this._props, __assign({}, propsAlt));
142
- copyProperties(this, __assign(__assign(__assign({}, dfParams), params), paramsAlt));
143
- //@ts-ignore
144
- this.sprite =
145
- (dfSpriteComponent === null || dfSpriteComponent === void 0 ? void 0 : dfSpriteComponent.output()) ||
146
- (spriteComponent === null || spriteComponent === void 0 ? void 0 : spriteComponent.output()) ||
147
- (spriteComponentAlt === null || spriteComponentAlt === void 0 ? void 0 : spriteComponentAlt.output()) ||
148
- new ColorSprite();
149
- };
150
- Entity.prototype.onPrepare = function () {
151
- return {};
152
- };
153
- Entity.prototype.update = function () {
154
- if (!this.isTerminate) {
155
- this.onUpdate();
156
- }
157
- for (var _i = 0, _a = this.timerJobListeners; _i < _a.length; _i++) {
158
- var jobListener = _a[_i];
159
- var timeCounter = jobListener.timeCounter, interval = jobListener.interval, job = jobListener.job, defaultRun = jobListener.defaultRun;
160
- if (defaultRun || timeCounter / 1000 >= interval) {
161
- timeCounter = 0;
162
- job();
163
- jobListener.defaultRun = false;
164
- }
165
- timeCounter += Renderer.deltaTime;
166
- jobListener.timeCounter = timeCounter;
167
- }
168
- };
169
- Entity.prototype.onUpdate = function () { };
170
- Entity.prototype.draw = function () {
171
- if (!this.isTerminate) {
172
- this.sprite.draw();
173
- }
174
- };
175
- Entity.prototype.onCollision = function (target) { };
176
- Entity.prototype.onCollisionEnd = function (target) { };
177
- Entity.prototype.onCollisionActive = function (target) { };
178
- return Entity;
179
- }(EntitySult));
180
- export { Entity };
@@ -1,17 +0,0 @@
1
- import { Body } from "matter-js";
2
- import { CreateBodyDefine, EntityInitial } from "../../export-types";
3
- import { Entity } from "./entity";
4
- export declare class RectEntity<P extends Record<string, any> = any> extends Entity<P> {
5
- width: number;
6
- height: number;
7
- onSpriteWidthHeightBinding(): {
8
- width: number;
9
- height: number;
10
- };
11
- protected onInitial(): EntityInitial<this>;
12
- protected onCreateBody({ x, y, ...transform }: NonNullable<CreateBodyDefine<{
13
- width?: number;
14
- height?: number;
15
- }>["transform"]>, options?: CreateBodyDefine["bodyOptions"]): Body;
16
- }
17
- //# sourceMappingURL=rect.entity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rect.entity.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/rect.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IACrE,KAAK,EAAG,MAAM,CAAC;IACf,MAAM,EAAG,MAAM,CAAC;IAEvB,0BAA0B,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAO/D,SAAS,CAAC,SAAS,IAAI,aAAa,CAAC,IAAI,CAAC;IAS1C,SAAS,CAAC,YAAY,CACpB,EACE,CAAC,EACD,CAAC,EACD,GAAG,SAAS,EACb,EAAE,WAAW,CACZ,gBAAgB,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC,WAAW,CAAC,CAChB,EACD,OAAO,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,GACxC,IAAI;CAIR"}
@@ -1,56 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __rest = (this && this.__rest) || function (s, e) {
17
- var t = {};
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
- t[p] = s[p];
20
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
- t[p[i]] = s[p[i]];
24
- }
25
- return t;
26
- };
27
- import { Bodies } from "matter-js";
28
- import { copyProperties } from "../../utils";
29
- import { Entity } from "./entity";
30
- var RectEntity = /** @class */ (function (_super) {
31
- __extends(RectEntity, _super);
32
- function RectEntity() {
33
- return _super !== null && _super.apply(this, arguments) || this;
34
- }
35
- RectEntity.prototype.onSpriteWidthHeightBinding = function () {
36
- return {
37
- width: this.width,
38
- height: this.height,
39
- };
40
- };
41
- RectEntity.prototype.onInitial = function () {
42
- return {
43
- transform: {
44
- width: 1,
45
- height: 1,
46
- },
47
- };
48
- };
49
- RectEntity.prototype.onCreateBody = function (_a, options) {
50
- var x = _a.x, y = _a.y, transform = __rest(_a, ["x", "y"]);
51
- copyProperties(this, transform);
52
- return Bodies.rectangle(x, y, this.width, this.height, options);
53
- };
54
- return RectEntity;
55
- }(Entity));
56
- export { RectEntity };
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic-component.d.ts","sourceRoot":"","sources":["../../src/classes/logic-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI1D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAIzD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;IAJ7B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,UAAU,EAAE,MAAM,CAAK;gBAEJ,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,EACxB,SAAS,CAAC,qBAAS;IAGtC,IAAI,QAAQ,wBAEX;IAED,IAAI,eAAe,CAAC,gBAAgB,EAAE,eAAe,EAMpD;IAED,MAAM,CAAC,EACL,eAAe,EACf,GAAG,YAAY,EAChB,GAAE;QACD,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,GAAG,WAAW,CAAC,CAAC,CAAM;CA6CxB"}
@@ -1,77 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- import { Entity } from "./entities/entity";
24
- import { EntitySult } from "./entities/entity-sult";
25
- var LogicComponent = /** @class */ (function () {
26
- function LogicComponent(configale, _isPrefab) {
27
- this.configale = configale;
28
- this._isPrefab = _isPrefab;
29
- this.layerIndex = 0;
30
- }
31
- Object.defineProperty(LogicComponent.prototype, "isPrefab", {
32
- get: function () {
33
- return this._isPrefab;
34
- },
35
- enumerable: false,
36
- configurable: true
37
- });
38
- Object.defineProperty(LogicComponent.prototype, "worldManagement", {
39
- set: function (_worldManagement) {
40
- if (this._worldManagement) {
41
- console.warn("Cant change worldManagement");
42
- }
43
- else {
44
- this._worldManagement = _worldManagement;
45
- }
46
- },
47
- enumerable: false,
48
- configurable: true
49
- });
50
- LogicComponent.prototype.output = function (_a) {
51
- if (_a === void 0) { _a = {}; }
52
- var worldManagement = _a.worldManagement, targetParams = __rest(_a, ["worldManagement"]);
53
- var configale = this.configale;
54
- var _b = Array.isArray(configale)
55
- ? configale
56
- : [configale], Class = _b[0], _c = _b[1], params = _c === void 0 ? {} : _c;
57
- var c = new Class();
58
- if (worldManagement) {
59
- this.worldManagement = worldManagement;
60
- }
61
- if (c instanceof EntitySult) {
62
- c["_layerIndex"] = this.layerIndex; // use _layerIndex to not trigger change index process at this step
63
- c.preInitial(this._worldManagement);
64
- }
65
- if (c instanceof Entity) {
66
- var _d = params, transform = _d.transform, bodyOptions = _d.bodyOptions, props = _d.props, restParams = __rest(_d, ["transform", "bodyOptions", "props"]);
67
- var extraTransform = targetParams.transform, extraBodyOptions = targetParams.bodyOptions, extraProps = targetParams.props, extraRestParams = __rest(targetParams, ["transform", "bodyOptions", "props"]);
68
- c.initial(__assign(__assign({ transform: __assign(__assign({}, transform), extraTransform), bodyOptions: __assign(__assign({}, bodyOptions), extraBodyOptions), props: __assign(__assign({}, props), extraProps) }, restParams), extraRestParams));
69
- }
70
- else {
71
- c.initial(__assign(__assign({}, params), targetParams));
72
- }
73
- return c;
74
- };
75
- return LogicComponent;
76
- }());
77
- export { LogicComponent };
@@ -1 +0,0 @@
1
- {"version":3,"file":"p5.d.ts","sourceRoot":"","sources":["../../src/classes/p5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,aAAK,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AACtC,aAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvB,oBAAY,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,qBAAa,EAAG,SAAQ,EAAE;IACxB,OAAO,UAAQ;gBAEH,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,IAAI;IAKpC,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC;CA+B9C"}
package/lib/classes/p5.js DELETED
@@ -1,58 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import p5 from "p5";
17
- var P5 = /** @class */ (function (_super) {
18
- __extends(P5, _super);
19
- function P5(sketch) {
20
- var _this = _super.call(this, sketch) || this;
21
- _this.running = true;
22
- window.Renderer = _this;
23
- return _this;
24
- }
25
- P5.prototype.choose = function (collection) {
26
- var lastItem = collection[collection.length - 1];
27
- var restItems = collection.slice(0, collection.length - 1);
28
- var totalPercentsOfRestItems = restItems.reduce(function (t, item) {
29
- return t + item[1];
30
- }, 0);
31
- if (totalPercentsOfRestItems > 1) {
32
- var overmax = totalPercentsOfRestItems - 1;
33
- var avg = 1 / restItems.length;
34
- for (var _i = 0, restItems_1 = restItems; _i < restItems_1.length; _i++) {
35
- var item = restItems_1[_i];
36
- if (item[1] > avg) {
37
- item[1] -= overmax;
38
- }
39
- }
40
- totalPercentsOfRestItems = 1;
41
- }
42
- lastItem[1] = 1 - totalPercentsOfRestItems;
43
- var items = [];
44
- var _loop_1 = function (item, percent) {
45
- Array.from({ length: Math.round(percent * 10) }).forEach(function () {
46
- items.push(item);
47
- });
48
- };
49
- for (var _a = 0, collection_1 = collection; _a < collection_1.length; _a++) {
50
- var _b = collection_1[_a], item = _b[0], percent = _b[1];
51
- _loop_1(item, percent);
52
- }
53
- this.shuffle(items, true);
54
- return this.random(items);
55
- };
56
- return P5;
57
- }(p5));
58
- export { P5 };
@@ -1 +0,0 @@
1
- {"version":3,"file":"particle-system.d.ts","sourceRoot":"","sources":["../../src/classes/particle-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,aAAK,aAAa,GAAG;IACnB,KAAK,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,QAAQ,CAAC,GAAG,QAAQ,CAAC;CACjE,CAAC;AAEF,aAAK,eAAe,GAAG,IAAI,CACzB,qBAAqB,EACrB,KAAK,GAAG,OAAO,GAAG,QAAQ,CAC3B,GAAG;IACF,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,aAAK,2BAA2B,GAAG;IACjC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,qBAAa,cAAe,SAAQ,UAAU,CAAC,2BAA2B,CAAC;IACzE,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,eAAe,CAGrB;IACF,OAAO,CAAC,aAAa,CAA2B;IAEzC,gBAAgB,EAAE,MAAM,CAAM;IAC9B,SAAS,EAAE,MAAM,CAAK;IAE7B,OAAO,CAAC,EACN,MAAM,EACN,eAAoB,EACpB,GAAG,MAAM,EACV,EAAE,2BAA2B;IAS9B,MAAM;IAyBN,IAAI;CAKL"}
@@ -1,98 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- var __rest = (this && this.__rest) || function (s, e) {
28
- var t = {};
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
30
- t[p] = s[p];
31
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
32
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
33
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
34
- t[p[i]] = s[p[i]];
35
- }
36
- return t;
37
- };
38
- import p5 from "p5";
39
- import { copyProperties } from "../utils";
40
- import { Particle } from "./particle";
41
- import { EntitySult } from "./entities/entity-sult";
42
- var ParticleSystem = /** @class */ (function (_super) {
43
- __extends(ParticleSystem, _super);
44
- function ParticleSystem() {
45
- var _this = _super !== null && _super.apply(this, arguments) || this;
46
- _this.particles = [];
47
- _this.forces = [];
48
- _this.particleOptions = {
49
- x: 0,
50
- y: 0,
51
- };
52
- _this.particleClass = Particle;
53
- _this.quantityPerFrame = 50;
54
- _this.vecWeight = 5;
55
- return _this;
56
- }
57
- ParticleSystem.prototype.initial = function (_a) {
58
- var _b;
59
- var forces = _a.forces, _c = _a.particleOptions, particleOptions = _c === void 0 ? {} : _c, params = __rest(_a, ["forces", "particleOptions"]);
60
- copyProperties(this.particleOptions, particleOptions);
61
- copyProperties(this, params);
62
- if (forces) {
63
- (_b = this.forces).push.apply(_b, forces);
64
- }
65
- };
66
- ParticleSystem.prototype.update = function () {
67
- var ParticleClass = this.particleClass;
68
- var _a = this.particleOptions, x = _a.x, y = _a.y, particleOptions = __rest(_a, ["x", "y"]);
69
- for (var _i = 0, _b = Array.from({ length: this.quantityPerFrame }); _i < _b.length; _i++) {
70
- var _ = _b[_i];
71
- var p = new ParticleClass(x, y);
72
- var vec = p5.Vector.random2D();
73
- vec.mult(Renderer.random(this.vecWeight));
74
- var angle = Renderer.random(Renderer.TWO_PI);
75
- p.initial(__assign(__assign({}, particleOptions), { camera: this.camera, vec: vec, angle: angle }));
76
- this.particles.push(p);
77
- }
78
- for (var i = this.particles.length - 1; i > -1; i--) {
79
- var p = this.particles[i];
80
- for (var _c = 0, _d = this.forces; _c < _d.length; _c++) {
81
- var force = _d[_c];
82
- p.applyForce(force);
83
- }
84
- p.update();
85
- if (p.isDead()) {
86
- this.particles.splice(i, 1);
87
- }
88
- }
89
- };
90
- ParticleSystem.prototype.draw = function () {
91
- for (var _i = 0, _a = this.particles; _i < _a.length; _i++) {
92
- var particle = _a[_i];
93
- particle.draw();
94
- }
95
- };
96
- return ParticleSystem;
97
- }(EntitySult));
98
- export { ParticleSystem };
@@ -1 +0,0 @@
1
- {"version":3,"file":"particle.d.ts","sourceRoot":"","sources":["../../src/classes/particle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,oBAAY,qBAAqB,GAAG;IAClC,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,qBAAa,QACX,SAAQ,EAAE,CAAC,MACX,YAAW,UAAU,CAAC,qBAAqB,CAAC;IAE5C,OAAO,CAAC,GAAG,CAAsC;IACjD,OAAO,CAAC,GAAG,CAAsC;IACjD,OAAO,CAAC,KAAK,CAAa;IACnB,MAAM,EAAG,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAmB;IAC/B,IAAI,EAAE,MAAM,CAAK;IACjB,cAAc,EAAE,MAAM,CAAiB;IAE9C,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,SAAS,CAAa;IAE9B,IAAI,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAG5B;IAED,IAAI,QAAQ,IALW,MAAM,CAO5B;IAED,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,EAAE,qBAAqB;IAOjD,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM;IAI3B,MAAM;IAIN,MAAM;IAQN,IAAI;IAmCJ,MAAM,CAAC,CAAC,EAAE,KAAK;CAGhB"}
@@ -1,117 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __rest = (this && this.__rest) || function (s, e) {
17
- var t = {};
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
- t[p] = s[p];
20
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
- t[p[i]] = s[p[i]];
24
- }
25
- return t;
26
- };
27
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
28
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
29
- if (ar || !(i in from)) {
30
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
31
- ar[i] = from[i];
32
- }
33
- }
34
- return to.concat(ar || Array.prototype.slice.call(from));
35
- };
36
- import p5 from "p5";
37
- import { copyProperties } from "../utils";
38
- var Particle = /** @class */ (function (_super) {
39
- __extends(Particle, _super);
40
- function Particle() {
41
- var _this = _super !== null && _super.apply(this, arguments) || this;
42
- _this.vec = Renderer.createVector(); //velocity
43
- _this.acc = Renderer.createVector(); //acceleration
44
- _this.angle = 0;
45
- _this.color = [255, 255, 255];
46
- _this.size = 5;
47
- _this.lifetimeRemain = _this.lifetime; // in seconds
48
- _this.forceSpriteSize = false;
49
- _this._lifetime = 2; // in seconds
50
- return _this;
51
- }
52
- Object.defineProperty(Particle.prototype, "lifetime", {
53
- get: function () {
54
- return this._lifetime;
55
- },
56
- set: function (lifetime) {
57
- this._lifetime = lifetime;
58
- this.lifetimeRemain = lifetime;
59
- },
60
- enumerable: false,
61
- configurable: true
62
- });
63
- Particle.prototype.initial = function (_a) {
64
- var vec = _a.vec, params = __rest(_a, ["vec"]);
65
- if (vec) {
66
- this.vec.set(vec.x, vec.y);
67
- }
68
- copyProperties(this, params);
69
- };
70
- Particle.prototype.applyForce = function (force) {
71
- this.acc.add(force);
72
- };
73
- Particle.prototype.isDead = function () {
74
- return this.lifetimeRemain <= 0;
75
- };
76
- Particle.prototype.update = function () {
77
- this.vec.add(this.acc);
78
- this.add(this.vec);
79
- this.acc.set(0);
80
- this.lifetimeRemain -= Renderer.deltaTime / 1000;
81
- };
82
- Particle.prototype.draw = function () {
83
- Renderer.push();
84
- Renderer.noStroke();
85
- Renderer.translate(this.x - this.camera.x, this.y - this.camera.y);
86
- Renderer.rotate(this.angle);
87
- var color = __spreadArray([], this.color, true);
88
- var alpha = Renderer.map(this.lifetimeRemain, 0, this.lifetime, 0, 255);
89
- color[3] = alpha;
90
- if (this.sprite) {
91
- var size = this.forceSpriteSize
92
- ? [this.size, this.size]
93
- : [this.sprite.width, this.sprite.height];
94
- Renderer.tint.apply(Renderer, color);
95
- Renderer.image.apply(Renderer, __spreadArray(__spreadArray([this.sprite,
96
- // position on canvas
97
- 0,
98
- 0], size, false), [
99
- //crop on source image
100
- 0,
101
- 0,
102
- this.sprite.width,
103
- this.sprite.height], false));
104
- }
105
- else {
106
- Renderer.fill.apply(Renderer, color);
107
- this.onDraw(color);
108
- }
109
- //
110
- Renderer.pop();
111
- };
112
- Particle.prototype.onDraw = function (_) {
113
- Renderer.circle(0, 0, this.size);
114
- };
115
- return Particle;
116
- }(p5.Vector));
117
- export { Particle };
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefab.d.ts","sourceRoot":"","sources":["../../src/classes/prefab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,MAAM,CACjB,CAAC,SAAS,UAAU,GAAG,UAAU,CACjC,SAAQ,cAAc,CAAC,CAAC,CAAC;gBACb,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;CAGrC"}
@@ -1,24 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { LogicComponent } from "./logic-component";
17
- var Prefab = /** @class */ (function (_super) {
18
- __extends(Prefab, _super);
19
- function Prefab(configale) {
20
- return _super.call(this, configale, true) || this;
21
- }
22
- return Prefab;
23
- }(LogicComponent));
24
- export { Prefab };
@@ -1 +0,0 @@
1
- {"version":3,"file":"saver.d.ts","sourceRoot":"","sources":["../../src/classes/saver.ts"],"names":[],"mappings":"AAAA,aAAK,KAAK,GACN,KAAK,GACL,SAAS,GACT,kBAAkB,GAClB,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,aAAK,SAAS,CACZ,CAAC,SAAS,GAAG,GAAG,SAAS,EACzB,CAAC,SAAS,KAAK,GAAG,KAAK,IACrB,CAAC,SAAS,SAAS,GACnB,CAAC,SAAS,kBAAkB,GAC1B,OAAO,GACP,CAAC,SAAS,iBAAiB,GAC3B,MAAM,GACN,CAAC,SAAS,iBAAiB,GAC3B,MAAM,GACN,CAAC,GACH,CAAC,CAAC;AAEN,cAAM,MAAM;IACV,OAAO,CAAC,KAAK,CAAuB;;IAOpC,GAAG,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAIrD,GAAG,CAAC,CAAC,SAAS,GAAG,GAAG,SAAS,EAAE,CAAC,SAAS,KAAK,GAAG,KAAK,EACpD,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,CAAC,GACP,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;CAoBnB;AAED,eAAO,MAAM,KAAK,QAAe,CAAC"}