melonjs 14.0.2 → 14.1.0
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.
- package/README.md +2 -0
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +10 -0
- package/dist/melonjs.mjs/_virtual/arraymultimap.js +10 -0
- package/dist/melonjs.mjs/_virtual/earcut.js +10 -0
- package/dist/melonjs.mjs/_virtual/howler.js +10 -0
- package/dist/melonjs.mjs/_virtual/index.js +10 -0
- package/dist/melonjs.mjs/_virtual/index2.js +10 -0
- package/dist/melonjs.mjs/_virtual/multimap.js +10 -0
- package/dist/melonjs.mjs/_virtual/setmultimap.js +10 -0
- package/dist/melonjs.mjs/application/application.js +240 -0
- package/dist/melonjs.mjs/audio/audio.js +536 -0
- package/dist/melonjs.mjs/camera/camera2d.js +732 -0
- package/dist/melonjs.mjs/entity/entity.js +248 -0
- package/dist/melonjs.mjs/game.js +29 -0
- package/dist/melonjs.mjs/geometries/ellipse.js +275 -0
- package/dist/melonjs.mjs/geometries/line.js +116 -0
- package/dist/melonjs.mjs/geometries/path2d.js +319 -0
- package/dist/melonjs.mjs/geometries/point.js +89 -0
- package/dist/melonjs.mjs/geometries/poly.js +500 -0
- package/dist/melonjs.mjs/geometries/rectangle.js +375 -0
- package/dist/melonjs.mjs/geometries/roundrect.js +168 -0
- package/dist/melonjs.mjs/index.js +248 -0
- package/dist/melonjs.mjs/input/gamepad.js +501 -0
- package/dist/melonjs.mjs/input/input.js +26 -0
- package/dist/melonjs.mjs/input/keyboard.js +470 -0
- package/dist/melonjs.mjs/input/pointer.js +393 -0
- package/dist/melonjs.mjs/input/pointerevent.js +818 -0
- package/dist/melonjs.mjs/lang/deprecated.js +157 -0
- package/dist/melonjs.mjs/level/level.js +297 -0
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +141 -0
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +448 -0
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +355 -0
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +194 -0
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +639 -0
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +311 -0
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +83 -0
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +367 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +506 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +220 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +157 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +125 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +109 -0
- package/dist/melonjs.mjs/loader/loader.js +801 -0
- package/dist/melonjs.mjs/loader/loadingscreen.js +120 -0
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +11 -0
- package/dist/melonjs.mjs/math/color.js +618 -0
- package/dist/melonjs.mjs/math/math.js +218 -0
- package/dist/melonjs.mjs/math/matrix2.js +503 -0
- package/dist/melonjs.mjs/math/matrix3.js +681 -0
- package/dist/melonjs.mjs/math/observable_vector2.js +471 -0
- package/dist/melonjs.mjs/math/observable_vector3.js +561 -0
- package/dist/melonjs.mjs/math/vector2.js +528 -0
- package/dist/melonjs.mjs/math/vector3.js +569 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +73 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +21 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +324 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +69 -0
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +691 -0
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +350 -0
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3241 -0
- package/dist/melonjs.mjs/particles/emitter.js +267 -0
- package/dist/melonjs.mjs/particles/particle.js +188 -0
- package/dist/melonjs.mjs/particles/settings.js +319 -0
- package/dist/melonjs.mjs/physics/body.js +704 -0
- package/dist/melonjs.mjs/physics/bounds.js +460 -0
- package/dist/melonjs.mjs/physics/collision.js +132 -0
- package/dist/melonjs.mjs/physics/detector.js +194 -0
- package/dist/melonjs.mjs/physics/quadtree.js +391 -0
- package/dist/melonjs.mjs/physics/response.js +57 -0
- package/dist/melonjs.mjs/physics/sat.js +483 -0
- package/dist/melonjs.mjs/physics/world.js +221 -0
- package/dist/melonjs.mjs/plugin/plugin.js +141 -0
- package/dist/melonjs.mjs/renderable/collectable.js +62 -0
- package/dist/melonjs.mjs/renderable/colorlayer.js +80 -0
- package/dist/melonjs.mjs/renderable/container.js +1018 -0
- package/dist/melonjs.mjs/renderable/dragndrop.js +224 -0
- package/dist/melonjs.mjs/renderable/imagelayer.js +306 -0
- package/dist/melonjs.mjs/renderable/light2d.js +156 -0
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +247 -0
- package/dist/melonjs.mjs/renderable/renderable.js +783 -0
- package/dist/melonjs.mjs/renderable/sprite.js +654 -0
- package/dist/melonjs.mjs/renderable/trigger.js +157 -0
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +213 -0
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +226 -0
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +128 -0
- package/dist/melonjs.mjs/state/stage.js +237 -0
- package/dist/melonjs.mjs/state/state.js +596 -0
- package/dist/melonjs.mjs/system/device.js +909 -0
- package/dist/melonjs.mjs/system/dom.js +78 -0
- package/dist/melonjs.mjs/system/event.js +537 -0
- package/dist/melonjs.mjs/system/platform.js +41 -0
- package/dist/melonjs.mjs/system/pooling.js +209 -0
- package/dist/melonjs.mjs/system/save.js +157 -0
- package/dist/melonjs.mjs/system/timer.js +286 -0
- package/dist/melonjs.mjs/text/bitmaptext.js +364 -0
- package/dist/melonjs.mjs/text/bitmaptextdata.js +199 -0
- package/dist/melonjs.mjs/text/glyph.js +66 -0
- package/dist/melonjs.mjs/text/text.js +453 -0
- package/dist/melonjs.mjs/text/textmetrics.js +176 -0
- package/dist/melonjs.mjs/text/textstyle.js +23 -0
- package/dist/melonjs.mjs/tweens/easing.js +336 -0
- package/dist/melonjs.mjs/tweens/interpolation.js +112 -0
- package/dist/melonjs.mjs/tweens/tween.js +480 -0
- package/dist/melonjs.mjs/utils/agent.js +76 -0
- package/dist/melonjs.mjs/utils/array.js +63 -0
- package/dist/melonjs.mjs/utils/file.js +42 -0
- package/dist/melonjs.mjs/utils/function.js +70 -0
- package/dist/melonjs.mjs/utils/string.js +82 -0
- package/dist/melonjs.mjs/utils/utils.js +173 -0
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +807 -0
- package/dist/melonjs.mjs/video/renderer.js +411 -0
- package/dist/melonjs.mjs/video/texture/atlas.js +519 -0
- package/dist/melonjs.mjs/video/texture/cache.js +143 -0
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +144 -0
- package/dist/melonjs.mjs/video/video.js +462 -0
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +143 -0
- package/dist/melonjs.mjs/video/webgl/glshader.js +168 -0
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +10 -0
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +25 -0
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -0
- package/dist/melonjs.mjs/video/webgl/utils/program.js +67 -0
- package/dist/melonjs.mjs/video/webgl/utils/string.js +25 -0
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +92 -0
- package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +495 -0
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1036 -0
- package/dist/melonjs.module.d.ts +1163 -1163
- package/dist/melonjs.module.js +1903 -3274
- package/package.json +22 -17
- package/src/application/application.js +3 -3
- package/src/audio/audio.js +32 -32
- package/src/camera/camera2d.js +31 -31
- package/src/entity/entity.js +17 -17
- package/src/geometries/ellipse.js +16 -16
- package/src/geometries/line.js +5 -5
- package/src/geometries/path2d.js +32 -32
- package/src/geometries/poly.js +15 -15
- package/src/geometries/rectangle.js +18 -18
- package/src/geometries/roundrect.js +8 -8
- package/src/input/gamepad.js +15 -15
- package/src/input/keyboard.js +12 -12
- package/src/input/pointer.js +6 -6
- package/src/input/pointerevent.js +12 -12
- package/src/lang/deprecated.js +12 -12
- package/src/level/level.js +25 -25
- package/src/level/tiled/TMXLayer.js +22 -22
- package/src/level/tiled/TMXTile.js +5 -5
- package/src/level/tiled/TMXTileMap.js +6 -6
- package/src/level/tiled/TMXTileset.js +2 -2
- package/src/level/tiled/TMXUtils.js +5 -5
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +19 -19
- package/src/loader/loader.js +20 -20
- package/src/math/color.js +20 -20
- package/src/math/math.js +16 -16
- package/src/math/matrix2.js +16 -16
- package/src/math/matrix3.js +25 -25
- package/src/math/observable_vector2.js +14 -14
- package/src/math/observable_vector3.js +16 -16
- package/src/math/vector2.js +9 -9
- package/src/math/vector3.js +10 -10
- package/src/particles/emitter.js +6 -6
- package/src/particles/particle.js +2 -2
- package/src/physics/body.js +28 -28
- package/src/physics/bounds.js +8 -8
- package/src/physics/collision.js +2 -2
- package/src/physics/detector.js +6 -6
- package/src/physics/quadtree.js +11 -11
- package/src/physics/sat.js +31 -31
- package/src/physics/world.js +5 -5
- package/src/plugin/plugin.js +5 -5
- package/src/renderable/collectable.js +3 -3
- package/src/renderable/colorlayer.js +5 -5
- package/src/renderable/container.js +21 -21
- package/src/renderable/dragndrop.js +14 -14
- package/src/renderable/imagelayer.js +13 -13
- package/src/renderable/light2d.js +3 -3
- package/src/renderable/nineslicesprite.js +16 -16
- package/src/renderable/renderable.js +23 -23
- package/src/renderable/sprite.js +28 -28
- package/src/renderable/trigger.js +15 -15
- package/src/renderable/ui/uibaseelement.js +7 -7
- package/src/renderable/ui/uispriteelement.js +6 -6
- package/src/renderable/ui/uitextbutton.js +13 -13
- package/src/state/stage.js +7 -7
- package/src/state/state.js +17 -17
- package/src/system/device.js +11 -11
- package/src/system/event.js +10 -10
- package/src/system/pooling.js +9 -9
- package/src/system/save.js +2 -2
- package/src/system/timer.js +10 -10
- package/src/text/bitmaptext.js +18 -18
- package/src/text/bitmaptextdata.js +2 -2
- package/src/text/text.js +23 -23
- package/src/text/textmetrics.js +8 -8
- package/src/tweens/tween.js +19 -19
- package/src/utils/agent.js +5 -5
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +2 -2
- package/src/utils/function.js +6 -6
- package/src/utils/string.js +5 -5
- package/src/utils/utils.js +4 -4
- package/src/video/canvas/canvas_renderer.js +70 -70
- package/src/video/renderer.js +26 -26
- package/src/video/texture/atlas.js +22 -22
- package/src/video/texture/canvas_texture.js +9 -9
- package/src/video/video.js +17 -17
- package/src/video/webgl/glshader.js +10 -10
- package/src/video/webgl/webgl_compositor.js +41 -41
- package/src/video/webgl/webgl_renderer.js +75 -75
package/src/particles/emitter.js
CHANGED
|
@@ -23,9 +23,9 @@ function createDefaultParticleTexture(w = 8, h = 8) {
|
|
|
23
23
|
*/
|
|
24
24
|
class ParticleEmitter extends Container {
|
|
25
25
|
/**
|
|
26
|
-
* @param {number} x x position of the particle emitter
|
|
27
|
-
* @param {number} y y position of the particle emitter
|
|
28
|
-
* @param {ParticleEmitterSettings} [settings=ParticleEmitterSettings] the settings for the particle emitter.
|
|
26
|
+
* @param {number} x - x position of the particle emitter
|
|
27
|
+
* @param {number} y - y position of the particle emitter
|
|
28
|
+
* @param {ParticleEmitterSettings} [settings=ParticleEmitterSettings] - the settings for the particle emitter.
|
|
29
29
|
* @example
|
|
30
30
|
* // Create a particle emitter at position 100, 100
|
|
31
31
|
* var emitter = new ParticleEmitter(100, 100, {
|
|
@@ -110,7 +110,7 @@ class ParticleEmitter extends Container {
|
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Reset the emitter with particle emitter settings.
|
|
113
|
-
* @param {ParticleEmitterSettings} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
113
|
+
* @param {ParticleEmitterSettings} settings - [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
114
114
|
*/
|
|
115
115
|
reset(settings = {}) {
|
|
116
116
|
Object.assign(this.settings, ParticleEmitterSettings, settings);
|
|
@@ -161,7 +161,7 @@ class ParticleEmitter extends Container {
|
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* Launch particles from emitter constantly (e.g. for stream)
|
|
164
|
-
* @param {number} duration [optional] time that the emitter releases particles in ms
|
|
164
|
+
* @param {number} duration - [optional] time that the emitter releases particles in ms
|
|
165
165
|
*/
|
|
166
166
|
streamParticles(duration) {
|
|
167
167
|
this._enabled = true;
|
|
@@ -179,7 +179,7 @@ class ParticleEmitter extends Container {
|
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
181
|
* Launch all particles from emitter and stop (e.g. for explosion)
|
|
182
|
-
* @param {number} total [optional] number of particles to launch
|
|
182
|
+
* @param {number} total - [optional] number of particles to launch
|
|
183
183
|
*/
|
|
184
184
|
burstParticles(total) {
|
|
185
185
|
this._enabled = true;
|
|
@@ -10,7 +10,7 @@ import Renderable from "./../renderable/renderable.js";
|
|
|
10
10
|
*/
|
|
11
11
|
class Particle extends Renderable {
|
|
12
12
|
/**
|
|
13
|
-
* @param {ParticleEmitter} emitter the particle emitter
|
|
13
|
+
* @param {ParticleEmitter} emitter - the particle emitter
|
|
14
14
|
*/
|
|
15
15
|
constructor(emitter) {
|
|
16
16
|
// Call the super constructor
|
|
@@ -107,7 +107,7 @@ class Particle extends Renderable {
|
|
|
107
107
|
* Update the Particle <br>
|
|
108
108
|
* This is automatically called by the game manager {@link game}
|
|
109
109
|
* @ignore
|
|
110
|
-
* @param {number} dt time since the last update in milliseconds
|
|
110
|
+
* @param {number} dt - time since the last update in milliseconds
|
|
111
111
|
*/
|
|
112
112
|
update(dt) {
|
|
113
113
|
// move things forward independent of the current frame rate
|
package/src/physics/body.js
CHANGED
|
@@ -16,9 +16,9 @@ import Point from "../geometries/point.js";
|
|
|
16
16
|
*/
|
|
17
17
|
class Body {
|
|
18
18
|
/**
|
|
19
|
-
* @param {Renderable} ancestor the parent object this body is attached to
|
|
20
|
-
* @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Point|Point[]|Bounds|Bounds[]|object} [shapes] a initial shape, list of shapes, or JSON object defining the body
|
|
21
|
-
* @param {Function} [onBodyUpdate] callback for when the body is updated (e.g. add/remove shapes)
|
|
19
|
+
* @param {Renderable} ancestor - the parent object this body is attached to
|
|
20
|
+
* @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Point|Point[]|Bounds|Bounds[]|object} [shapes] - a initial shape, list of shapes, or JSON object defining the body
|
|
21
|
+
* @param {Function} [onBodyUpdate] - callback for when the body is updated (e.g. add/remove shapes)
|
|
22
22
|
*/
|
|
23
23
|
constructor(ancestor, shapes, onBodyUpdate) {
|
|
24
24
|
|
|
@@ -236,7 +236,7 @@ class Body {
|
|
|
236
236
|
/**
|
|
237
237
|
* add a collision shape to this body <br>
|
|
238
238
|
* (note: me.Rect objects will be converted to me.Polygon before being added)
|
|
239
|
-
* @param {Rect|Polygon|Line|Ellipse|Point|Point[]|Bounds|object} shape a shape or JSON object
|
|
239
|
+
* @param {Rect|Polygon|Line|Ellipse|Point|Point[]|Bounds|object} shape - a shape or JSON object
|
|
240
240
|
* @returns {number} the shape array length
|
|
241
241
|
* @example
|
|
242
242
|
* // add a rectangle shape
|
|
@@ -292,9 +292,9 @@ class Body {
|
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
294
|
* set the body vertices to the given one
|
|
295
|
-
* @param {Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
|
|
296
|
-
* @param {number} [index=0] the shape object for which to set the vertices
|
|
297
|
-
* @param {boolean} [clear=true] either to reset the body definition before adding the new vertices
|
|
295
|
+
* @param {Vector2d[]} vertices - an array of me.Vector2d points defining a convex hull
|
|
296
|
+
* @param {number} [index=0] - the shape object for which to set the vertices
|
|
297
|
+
* @param {boolean} [clear=true] - either to reset the body definition before adding the new vertices
|
|
298
298
|
*/
|
|
299
299
|
setVertices(vertices, index = 0, clear = true) {
|
|
300
300
|
var polygon = this.getShape(index);
|
|
@@ -315,8 +315,8 @@ class Body {
|
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* add the given vertices to the body shape
|
|
318
|
-
* @param {Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
|
|
319
|
-
* @param {number} [index=0] the shape object for which to set the vertices
|
|
318
|
+
* @param {Vector2d[]} vertices - an array of me.Vector2d points defining a convex hull
|
|
319
|
+
* @param {number} [index=0] - the shape object for which to set the vertices
|
|
320
320
|
*/
|
|
321
321
|
addVertices(vertices, index = 0) {
|
|
322
322
|
this.setVertices(vertices, index, false);
|
|
@@ -325,8 +325,8 @@ class Body {
|
|
|
325
325
|
/**
|
|
326
326
|
* add collision mesh based on a JSON object
|
|
327
327
|
* (this will also apply any physic properties defined in the given JSON file)
|
|
328
|
-
* @param {object} json a JSON object as exported from a Physics Editor tool
|
|
329
|
-
* @param {string} [id] an optional shape identifier within the given the json object
|
|
328
|
+
* @param {object} json - a JSON object as exported from a Physics Editor tool
|
|
329
|
+
* @param {string} [id] - an optional shape identifier within the given the json object
|
|
330
330
|
* @see https://www.codeandweb.com/physicseditor
|
|
331
331
|
* @returns {number} how many shapes were added to the body
|
|
332
332
|
* @example
|
|
@@ -365,7 +365,7 @@ class Body {
|
|
|
365
365
|
|
|
366
366
|
/**
|
|
367
367
|
* return the collision shape at the given index
|
|
368
|
-
* @param {number} [index=0] the shape object at the specified index
|
|
368
|
+
* @param {number} [index=0] - the shape object at the specified index
|
|
369
369
|
* @returns {Polygon|Line|Ellipse} shape a shape object if defined
|
|
370
370
|
*/
|
|
371
371
|
getShape(index) {
|
|
@@ -382,7 +382,7 @@ class Body {
|
|
|
382
382
|
|
|
383
383
|
/**
|
|
384
384
|
* remove the specified shape from the body shape list
|
|
385
|
-
* @param {Polygon|Line|Ellipse} shape a shape object
|
|
385
|
+
* @param {Polygon|Line|Ellipse} shape - a shape object
|
|
386
386
|
* @returns {number} the shape array length
|
|
387
387
|
*/
|
|
388
388
|
removeShape(shape) {
|
|
@@ -400,7 +400,7 @@ class Body {
|
|
|
400
400
|
|
|
401
401
|
/**
|
|
402
402
|
* remove the shape at the given index from the body shape list
|
|
403
|
-
* @param {number} index the shape object at the specified index
|
|
403
|
+
* @param {number} index - the shape object at the specified index
|
|
404
404
|
* @returns {number} the shape array length
|
|
405
405
|
*/
|
|
406
406
|
removeShapeAt(index) {
|
|
@@ -412,7 +412,7 @@ class Body {
|
|
|
412
412
|
* but it's also possible to specify 'collision filters' to provide a finer <br>
|
|
413
413
|
* control over which body can collide with each other.
|
|
414
414
|
* @see collision.types
|
|
415
|
-
* @param {number} [bitmask = collision.types.ALL_OBJECT] the collision mask
|
|
415
|
+
* @param {number} [bitmask = collision.types.ALL_OBJECT] - the collision mask
|
|
416
416
|
* @example
|
|
417
417
|
* // filter collision detection with collision shapes, enemies and collectables
|
|
418
418
|
* body.setCollisionMask(me.collision.types.WORLD_SHAPE | me.collision.types.ENEMY_OBJECT | me.collision.types.COLLECTABLE_OBJECT);
|
|
@@ -427,7 +427,7 @@ class Body {
|
|
|
427
427
|
/**
|
|
428
428
|
* define the collision type of the body for collision filtering
|
|
429
429
|
* @see collision.types
|
|
430
|
-
* @param {number} type the collision type
|
|
430
|
+
* @param {number} type - the collision type
|
|
431
431
|
* @example
|
|
432
432
|
* // set the body collision type
|
|
433
433
|
* body.collisionType = me.collision.types.PLAYER_OBJECT;
|
|
@@ -444,7 +444,7 @@ class Body {
|
|
|
444
444
|
|
|
445
445
|
/**
|
|
446
446
|
* the built-in function to solve the collision response
|
|
447
|
-
* @param {object} response the collision response object (see {@link ResponseObject})
|
|
447
|
+
* @param {object} response - the collision response object (see {@link ResponseObject})
|
|
448
448
|
*/
|
|
449
449
|
respondToCollision(response) {
|
|
450
450
|
// the overlap vector
|
|
@@ -483,8 +483,8 @@ class Body {
|
|
|
483
483
|
* - The current element being processed in the array <br>
|
|
484
484
|
* - The index of element in the array. <br>
|
|
485
485
|
* - The array forEach() was called upon. <br>
|
|
486
|
-
* @param {Function} callback fnction to execute on each element
|
|
487
|
-
* @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
|
|
486
|
+
* @param {Function} callback - fnction to execute on each element
|
|
487
|
+
* @param {object} [thisArg] - value to use as this(i.e reference Object) when executing callback.
|
|
488
488
|
* @example
|
|
489
489
|
* // iterate through all shapes of the physic body
|
|
490
490
|
* mySprite.body.forEach((shape) => {
|
|
@@ -522,8 +522,8 @@ class Body {
|
|
|
522
522
|
*/
|
|
523
523
|
/**
|
|
524
524
|
* Returns true if the any of the shape composing the body contains the given point.
|
|
525
|
-
* @param {number} x x coordinate
|
|
526
|
-
* @param {number} y y coordinate
|
|
525
|
+
* @param {number} x - x coordinate
|
|
526
|
+
* @param {number} y - y coordinate
|
|
527
527
|
* @returns {boolean} true if contains
|
|
528
528
|
*/
|
|
529
529
|
contains() {
|
|
@@ -553,8 +553,8 @@ class Body {
|
|
|
553
553
|
/**
|
|
554
554
|
* Rotate this body (counter-clockwise) by the specified angle (in radians).
|
|
555
555
|
* Unless specified the body will be rotated around its center point
|
|
556
|
-
* @param {number} angle The angle to rotate (in radians)
|
|
557
|
-
* @param {Vector2d|ObservableVector2d} [v=Body.getBounds().center] an optional point to rotate around
|
|
556
|
+
* @param {number} angle - The angle to rotate (in radians)
|
|
557
|
+
* @param {Vector2d|ObservableVector2d} [v=Body.getBounds().center] - an optional point to rotate around
|
|
558
558
|
* @returns {Body} Reference to this object for method chaining
|
|
559
559
|
*/
|
|
560
560
|
rotate(angle, v = this.getBounds().center) {
|
|
@@ -577,8 +577,8 @@ class Body {
|
|
|
577
577
|
|
|
578
578
|
/**
|
|
579
579
|
* cap the body velocity (body.maxVel property) to the specified value<br>
|
|
580
|
-
* @param {number} x max velocity on x axis
|
|
581
|
-
* @param {number} y max velocity on y axis
|
|
580
|
+
* @param {number} x - max velocity on x axis
|
|
581
|
+
* @param {number} y - max velocity on y axis
|
|
582
582
|
*/
|
|
583
583
|
setMaxVelocity(x, y) {
|
|
584
584
|
this.maxVel.x = x;
|
|
@@ -587,8 +587,8 @@ class Body {
|
|
|
587
587
|
|
|
588
588
|
/**
|
|
589
589
|
* set the body default friction
|
|
590
|
-
* @param {number} x horizontal friction
|
|
591
|
-
* @param {number} y vertical friction
|
|
590
|
+
* @param {number} x - horizontal friction
|
|
591
|
+
* @param {number} y - vertical friction
|
|
592
592
|
*/
|
|
593
593
|
setFriction(x = 0, y = 0) {
|
|
594
594
|
this.friction.x = x;
|
|
@@ -605,7 +605,7 @@ class Body {
|
|
|
605
605
|
* Updates to Body.vel are bounded by maxVel (which defaults to viewport size if not set) <br>
|
|
606
606
|
* At this time a call to Body.Update does not call the onBodyUpdate callback that is listed in the constructor arguments.
|
|
607
607
|
* @protected
|
|
608
|
-
* @param {number} dt time since the last update in milliseconds.
|
|
608
|
+
* @param {number} dt - time since the last update in milliseconds.
|
|
609
609
|
* @returns {boolean} true if resulting velocity is different than 0
|
|
610
610
|
*/
|
|
611
611
|
update(dt) { // eslint-disable-line no-unused-vars
|
package/src/physics/bounds.js
CHANGED
|
@@ -7,7 +7,7 @@ import Vector2d from "./../math/vector2.js";
|
|
|
7
7
|
*/
|
|
8
8
|
class Bounds {
|
|
9
9
|
/**
|
|
10
|
-
* @param {Vector2d[]} [vertices] an array of me.Vector2d points
|
|
10
|
+
* @param {Vector2d[]} [vertices] - an array of me.Vector2d points
|
|
11
11
|
*/
|
|
12
12
|
constructor(vertices) {
|
|
13
13
|
// @ignore
|
|
@@ -203,7 +203,7 @@ class Bounds {
|
|
|
203
203
|
* Updates bounds using the given vertices
|
|
204
204
|
* @name update
|
|
205
205
|
* @memberof Bounds
|
|
206
|
-
* @param {Vector2d[]} vertices an array of me.Vector2d points
|
|
206
|
+
* @param {Vector2d[]} vertices - an array of me.Vector2d points
|
|
207
207
|
*/
|
|
208
208
|
update(vertices) {
|
|
209
209
|
this.add(vertices, true);
|
|
@@ -213,8 +213,8 @@ class Bounds {
|
|
|
213
213
|
* add the given vertices to the bounds definition.
|
|
214
214
|
* @name add
|
|
215
215
|
* @memberof Bounds
|
|
216
|
-
* @param {Vector2d[]} vertices an array of me.Vector2d points
|
|
217
|
-
* @param {boolean} [clear=false] either to reset the bounds before adding the new vertices
|
|
216
|
+
* @param {Vector2d[]} vertices - an array of me.Vector2d points
|
|
217
|
+
* @param {boolean} [clear=false] - either to reset the bounds before adding the new vertices
|
|
218
218
|
*/
|
|
219
219
|
add(vertices, clear = false) {
|
|
220
220
|
if (clear === true) {
|
|
@@ -234,7 +234,7 @@ class Bounds {
|
|
|
234
234
|
* @name addBounds
|
|
235
235
|
* @memberof Bounds
|
|
236
236
|
* @param {Bounds} bounds
|
|
237
|
-
* @param {boolean} [clear=false] either to reset the bounds before adding the new vertices
|
|
237
|
+
* @param {boolean} [clear=false] - either to reset the bounds before adding the new vertices
|
|
238
238
|
*/
|
|
239
239
|
addBounds(bounds, clear = false) {
|
|
240
240
|
if (clear === true) {
|
|
@@ -254,8 +254,8 @@ class Bounds {
|
|
|
254
254
|
* add the given point to the bounds definition.
|
|
255
255
|
* @name addPoint
|
|
256
256
|
* @memberof Bounds
|
|
257
|
-
* @param {Vector2d|Point} point the point to be added to the bounds
|
|
258
|
-
* @param {Matrix2d} [m] an optional transform to apply to the given point (only if the given point is a vector)
|
|
257
|
+
* @param {Vector2d|Point} point - the point to be added to the bounds
|
|
258
|
+
* @param {Matrix2d} [m] - an optional transform to apply to the given point (only if the given point is a vector)
|
|
259
259
|
*/
|
|
260
260
|
addPoint(point, m) {
|
|
261
261
|
if ((typeof m !== "undefined") && (typeof point.rotate === "function")) {
|
|
@@ -276,7 +276,7 @@ class Bounds {
|
|
|
276
276
|
* @param {number} y0 - top Y coordinates of the quad
|
|
277
277
|
* @param {number} x1 - right X coordinates of the quad
|
|
278
278
|
* @param {number} y1 - bottom y coordinates of the quad
|
|
279
|
-
* @param {Matrix2d} [m] an optional transform to apply to the given frame coordinates
|
|
279
|
+
* @param {Matrix2d} [m] - an optional transform to apply to the given frame coordinates
|
|
280
280
|
*/
|
|
281
281
|
addFrame(x0, y0, x1, y1, m) {
|
|
282
282
|
var v = pool.pull("Vector2d");
|
package/src/physics/collision.js
CHANGED
|
@@ -96,8 +96,8 @@ var collision = {
|
|
|
96
96
|
* @name rayCast
|
|
97
97
|
* @memberof collision
|
|
98
98
|
* @public
|
|
99
|
-
* @param {Line} line line to be tested for collision
|
|
100
|
-
* @param {Array.<Renderable>} [result] a user defined array that will be populated with intersecting physic objects.
|
|
99
|
+
* @param {Line} line - line to be tested for collision
|
|
100
|
+
* @param {Array.<Renderable>} [result] - a user defined array that will be populated with intersecting physic objects.
|
|
101
101
|
* @returns {Array.<Renderable>} an array of intersecting physic objects
|
|
102
102
|
* @example
|
|
103
103
|
* // define a line accross the viewport
|
package/src/physics/detector.js
CHANGED
|
@@ -28,8 +28,8 @@ let globalResponse = new ResponseObject();
|
|
|
28
28
|
* @name shouldCollide
|
|
29
29
|
* @memberof collision
|
|
30
30
|
* @ignore
|
|
31
|
-
* @param {Renderable} a a reference to the object A.
|
|
32
|
-
* @param {Renderable} b a reference to the object B.
|
|
31
|
+
* @param {Renderable} a - a reference to the object A.
|
|
32
|
+
* @param {Renderable} b - a reference to the object B.
|
|
33
33
|
* @returns {boolean} true if they should collide, false otherwise
|
|
34
34
|
*/
|
|
35
35
|
function shouldCollide(a, b) {
|
|
@@ -52,8 +52,8 @@ function shouldCollide(a, b) {
|
|
|
52
52
|
* find all the collisions for the specified object
|
|
53
53
|
* @name collisionCheck
|
|
54
54
|
* @ignore
|
|
55
|
-
* @param {Renderable} objA object to be tested for collision
|
|
56
|
-
* @param {ResponseObject} [response] a user defined response object that will be populated if they intersect.
|
|
55
|
+
* @param {Renderable} objA - object to be tested for collision
|
|
56
|
+
* @param {ResponseObject} [response] - a user defined response object that will be populated if they intersect.
|
|
57
57
|
* @returns {boolean} in case of collision, false otherwise
|
|
58
58
|
*/
|
|
59
59
|
export function collisionCheck(objA, response = globalResponse) {
|
|
@@ -115,8 +115,8 @@ export function collisionCheck(objA, response = globalResponse) {
|
|
|
115
115
|
* Checks for object colliding with the given line
|
|
116
116
|
* @name rayCast
|
|
117
117
|
* @ignore
|
|
118
|
-
* @param {Line} line line to be tested for collision
|
|
119
|
-
* @param {Array.<Renderable>} [result] a user defined array that will be populated with intersecting physic objects.
|
|
118
|
+
* @param {Line} line - line to be tested for collision
|
|
119
|
+
* @param {Array.<Renderable>} [result] - a user defined array that will be populated with intersecting physic objects.
|
|
120
120
|
* @returns {Array.<Renderable>} an array of intersecting physic objects
|
|
121
121
|
* @example
|
|
122
122
|
* // define a line accross the viewport
|
package/src/physics/quadtree.js
CHANGED
|
@@ -55,11 +55,11 @@ var QT_VECTOR = new Vector2d();
|
|
|
55
55
|
*/
|
|
56
56
|
class QuadTree {
|
|
57
57
|
/**
|
|
58
|
-
* @param {World} world the physic world this QuadTree belongs to
|
|
59
|
-
* @param {Bounds} bounds bounds of the node
|
|
60
|
-
* @param {number} [max_objects=4] max objects a node can hold before splitting into 4 subnodes
|
|
61
|
-
* @param {number} [max_levels=4] total max levels inside root Quadtree
|
|
62
|
-
* @param {number} [level] deepth level, required for subnodes
|
|
58
|
+
* @param {World} world - the physic world this QuadTree belongs to
|
|
59
|
+
* @param {Bounds} bounds - bounds of the node
|
|
60
|
+
* @param {number} [max_objects=4] - max objects a node can hold before splitting into 4 subnodes
|
|
61
|
+
* @param {number} [max_levels=4] - total max levels inside root Quadtree
|
|
62
|
+
* @param {number} [level] - deepth level, required for subnodes
|
|
63
63
|
*/
|
|
64
64
|
constructor(world, bounds, max_objects = 4, max_levels = 4, level = 0) {
|
|
65
65
|
|
|
@@ -194,7 +194,7 @@ class QuadTree {
|
|
|
194
194
|
* Insert the given object container into the node.
|
|
195
195
|
* @name insertContainer
|
|
196
196
|
* @memberof QuadTree
|
|
197
|
-
* @param {Container} container group of objects to be added
|
|
197
|
+
* @param {Container} container - group of objects to be added
|
|
198
198
|
*/
|
|
199
199
|
insertContainer(container) {
|
|
200
200
|
for (var i = container.children.length, child; i--, (child = container.children[i]);) {
|
|
@@ -222,7 +222,7 @@ class QuadTree {
|
|
|
222
222
|
* objects to their corresponding subnodes.
|
|
223
223
|
* @name insert
|
|
224
224
|
* @memberof QuadTree
|
|
225
|
-
* @param {object} item object to be added
|
|
225
|
+
* @param {object} item - object to be added
|
|
226
226
|
*/
|
|
227
227
|
insert(item) {
|
|
228
228
|
var index = -1;
|
|
@@ -266,8 +266,8 @@ class QuadTree {
|
|
|
266
266
|
* Return all objects that could collide with the given object
|
|
267
267
|
* @name retrieve
|
|
268
268
|
* @memberof QuadTree
|
|
269
|
-
* @param {object} item object to be checked against
|
|
270
|
-
* @param {object} [fn] a sorting function for the returned array
|
|
269
|
+
* @param {object} item - object to be checked against
|
|
270
|
+
* @param {object} [fn] - a sorting function for the returned array
|
|
271
271
|
* @returns {object[]} array with all detected objects
|
|
272
272
|
*/
|
|
273
273
|
retrieve(item, fn) {
|
|
@@ -301,7 +301,7 @@ class QuadTree {
|
|
|
301
301
|
* (this function won't recalculate the impacted node)
|
|
302
302
|
* @name remove
|
|
303
303
|
* @memberof QuadTree
|
|
304
|
-
* @param {object} item object to be removed
|
|
304
|
+
* @param {object} item - object to be removed
|
|
305
305
|
* @returns {boolean} true if the item was found and removed.
|
|
306
306
|
*/
|
|
307
307
|
remove(item) {
|
|
@@ -367,7 +367,7 @@ class QuadTree {
|
|
|
367
367
|
* clear the quadtree
|
|
368
368
|
* @name clear
|
|
369
369
|
* @memberof QuadTree
|
|
370
|
-
* @param {Bounds} [bounds=this.bounds] the bounds to be cleared
|
|
370
|
+
* @param {Bounds} [bounds=this.bounds] - the bounds to be cleared
|
|
371
371
|
*/
|
|
372
372
|
clear(bounds) {
|
|
373
373
|
this.objects.length = 0;
|
package/src/physics/sat.js
CHANGED
|
@@ -46,9 +46,9 @@ for (var a = 0; a < 5; a++) { T_ARRAYS.push([]); }
|
|
|
46
46
|
* resulting in a one dimensional range of the minimum and
|
|
47
47
|
* maximum value on that axis.
|
|
48
48
|
* @ignore
|
|
49
|
-
* @param {Array.<Vector2d>} points The points to flatten.
|
|
50
|
-
* @param {Vector2d} normal The unit vector axis to flatten on.
|
|
51
|
-
* @param {Array.<number>} result An array. After calling this function,
|
|
49
|
+
* @param {Array.<Vector2d>} points - The points to flatten.
|
|
50
|
+
* @param {Vector2d} normal - The unit vector axis to flatten on.
|
|
51
|
+
* @param {Array.<number>} result - An array. After calling this function,
|
|
52
52
|
* result[0] will be the minimum value,
|
|
53
53
|
* result[1] will be the maximum value.
|
|
54
54
|
*/
|
|
@@ -70,13 +70,13 @@ function flattenPointsOn(points, normal, result) {
|
|
|
70
70
|
* Check whether two convex polygons are separated by the specified
|
|
71
71
|
* axis (must be a unit vector).
|
|
72
72
|
* @ignore
|
|
73
|
-
* @param {Vector2d} aPos The position of the first polygon.
|
|
74
|
-
* @param {Vector2d} bPos The position of the second polygon.
|
|
75
|
-
* @param {Array.<Vector2d>} aPoints The points in the first polygon.
|
|
76
|
-
* @param {Array.<Vector2d>} bPoints The points in the second polygon.
|
|
77
|
-
* @param {Vector2d} axis The axis (unit sized) to test against. The points of both polygons
|
|
73
|
+
* @param {Vector2d} aPos - The position of the first polygon.
|
|
74
|
+
* @param {Vector2d} bPos - The position of the second polygon.
|
|
75
|
+
* @param {Array.<Vector2d>} aPoints - The points in the first polygon.
|
|
76
|
+
* @param {Array.<Vector2d>} bPoints - The points in the second polygon.
|
|
77
|
+
* @param {Vector2d} axis - The axis (unit sized) to test against. The points of both polygons
|
|
78
78
|
* will be projected onto this axis.
|
|
79
|
-
* @param {Response=} response A Response object (optional) which will be populated
|
|
79
|
+
* @param {Response=} response - A Response object (optional) which will be populated
|
|
80
80
|
* if the axis is not a separating axis.
|
|
81
81
|
* @returns {boolean} true if it is a separating axis, false otherwise. If false,
|
|
82
82
|
* and a response is passed in, information about how much overlap and
|
|
@@ -161,8 +161,8 @@ function isSeparatingAxis(aPos, bPos, aPoints, bPoints, axis, response) {
|
|
|
161
161
|
* </pre>
|
|
162
162
|
*
|
|
163
163
|
* @ignore
|
|
164
|
-
* @param {Vector2d} line The line segment.
|
|
165
|
-
* @param {Vector2d} point The point.
|
|
164
|
+
* @param {Vector2d} line - The line segment.
|
|
165
|
+
* @param {Vector2d} point - The point.
|
|
166
166
|
* @returns {number} LEFT_VORNOI_REGION (-1) if it is the left region,
|
|
167
167
|
* MIDDLE_VORNOI_REGION (0) if it is the middle region,
|
|
168
168
|
* RIGHT_VORNOI_REGION (1) if it is the right region.
|
|
@@ -187,11 +187,11 @@ function vornoiRegion(line, point) {
|
|
|
187
187
|
/**
|
|
188
188
|
* Checks whether polygons collide.
|
|
189
189
|
* @ignore
|
|
190
|
-
* @param {Renderable} a a reference to the object A.
|
|
191
|
-
* @param {Polygon} polyA a reference to the object A Polygon to be tested
|
|
192
|
-
* @param {Renderable} b a reference to the object B.
|
|
193
|
-
* @param {Polygon} polyB a reference to the object B Polygon to be tested
|
|
194
|
-
* @param {Response=} response Response object (optional) that will be populated if they intersect.
|
|
190
|
+
* @param {Renderable} a - a reference to the object A.
|
|
191
|
+
* @param {Polygon} polyA - a reference to the object A Polygon to be tested
|
|
192
|
+
* @param {Renderable} b - a reference to the object B.
|
|
193
|
+
* @param {Polygon} polyB - a reference to the object B Polygon to be tested
|
|
194
|
+
* @param {Response=} response - Response object (optional) that will be populated if they intersect.
|
|
195
195
|
* @returns {boolean} true if they intersect, false if they don't.
|
|
196
196
|
*/
|
|
197
197
|
export function testPolygonPolygon(a, polyA, b, polyB, response) {
|
|
@@ -241,11 +241,11 @@ export function testPolygonPolygon(a, polyA, b, polyB, response) {
|
|
|
241
241
|
/**
|
|
242
242
|
* Check if two Ellipse collide.
|
|
243
243
|
* @ignore
|
|
244
|
-
* @param {Renderable} a a reference to the object A.
|
|
245
|
-
* @param {Ellipse} ellipseA a reference to the object A Ellipse to be tested
|
|
246
|
-
* @param {Renderable} b a reference to the object B.
|
|
247
|
-
* @param {Ellipse} ellipseB a reference to the object B Ellipse to be tested
|
|
248
|
-
* @param {Response=} response Response object (optional) that will be populated if
|
|
244
|
+
* @param {Renderable} a - a reference to the object A.
|
|
245
|
+
* @param {Ellipse} ellipseA - a reference to the object A Ellipse to be tested
|
|
246
|
+
* @param {Renderable} b - a reference to the object B.
|
|
247
|
+
* @param {Ellipse} ellipseB - a reference to the object B Ellipse to be tested
|
|
248
|
+
* @param {Response=} response - Response object (optional) that will be populated if
|
|
249
249
|
* the circles intersect.
|
|
250
250
|
* @returns {boolean} true if the circles intersect, false if they don't.
|
|
251
251
|
*/
|
|
@@ -282,11 +282,11 @@ export function testEllipseEllipse(a, ellipseA, b, ellipseB, response) {
|
|
|
282
282
|
/**
|
|
283
283
|
* Check if a polygon and an ellipse collide.
|
|
284
284
|
* @ignore
|
|
285
|
-
* @param {Renderable} a a reference to the object A.
|
|
286
|
-
* @param {Polygon} polyA a reference to the object A Polygon to be tested
|
|
287
|
-
* @param {Renderable} b a reference to the object B.
|
|
288
|
-
* @param {Ellipse} ellipseB a reference to the object B Ellipse to be tested
|
|
289
|
-
* @param {Response=} response Response object (optional) that will be populated if they intersect.
|
|
285
|
+
* @param {Renderable} a - a reference to the object A.
|
|
286
|
+
* @param {Polygon} polyA - a reference to the object A Polygon to be tested
|
|
287
|
+
* @param {Renderable} b - a reference to the object B.
|
|
288
|
+
* @param {Ellipse} ellipseB - a reference to the object B Ellipse to be tested
|
|
289
|
+
* @param {Response=} response - Response object (optional) that will be populated if they intersect.
|
|
290
290
|
* @returns {boolean} true if they intersect, false if they don't.
|
|
291
291
|
*/
|
|
292
292
|
export function testPolygonEllipse(a, polyA, b, ellipseB, response) {
|
|
@@ -448,11 +448,11 @@ export function testPolygonEllipse(a, polyA, b, ellipseB, response) {
|
|
|
448
448
|
* **NOTE:** This is slightly less efficient than testPolygonEllipse as it just
|
|
449
449
|
* runs testPolygonEllipse and reverses the response at the end.
|
|
450
450
|
* @ignore
|
|
451
|
-
* @param {Renderable} a a reference to the object A.
|
|
452
|
-
* @param {Ellipse} ellipseA a reference to the object A Ellipse to be tested
|
|
453
|
-
* @param {Renderable} b a reference to the object B.
|
|
454
|
-
* @param {Polygon} polyB a reference to the object B Polygon to be tested
|
|
455
|
-
* @param {Response=} response Response object (optional) that will be populated if
|
|
451
|
+
* @param {Renderable} a - a reference to the object A.
|
|
452
|
+
* @param {Ellipse} ellipseA - a reference to the object A Ellipse to be tested
|
|
453
|
+
* @param {Renderable} b - a reference to the object B.
|
|
454
|
+
* @param {Polygon} polyB - a reference to the object B Polygon to be tested
|
|
455
|
+
* @param {Response=} response - Response object (optional) that will be populated if
|
|
456
456
|
* they intersect.
|
|
457
457
|
* @returns {boolean} true if they intersect, false if they don't.
|
|
458
458
|
*/
|
package/src/physics/world.js
CHANGED
|
@@ -13,10 +13,10 @@ import state from "./../state/state.js";
|
|
|
13
13
|
*/
|
|
14
14
|
class World extends Container {
|
|
15
15
|
/**
|
|
16
|
-
* @param {number} [x=0] position of the container (accessible via the inherited pos.x property)
|
|
17
|
-
* @param {number} [y=0] position of the container (accessible via the inherited pos.y property)
|
|
18
|
-
* @param {number} [width=game.viewport.width] width of the container
|
|
19
|
-
* @param {number} [height=game.viewport.height] height of the container
|
|
16
|
+
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
17
|
+
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
18
|
+
* @param {number} [width=game.viewport.width] - width of the container
|
|
19
|
+
* @param {number} [height=game.viewport.height] - height of the container
|
|
20
20
|
*/
|
|
21
21
|
constructor(x = 0, y = 0, width = Infinity, height = Infinity) {
|
|
22
22
|
// call the super constructor
|
|
@@ -169,7 +169,7 @@ class World extends Container {
|
|
|
169
169
|
* update the game world
|
|
170
170
|
* @name reset
|
|
171
171
|
* @memberof World
|
|
172
|
-
* @param {number} dt the time passed since the last frame update
|
|
172
|
+
* @param {number} dt - the time passed since the last frame update
|
|
173
173
|
* @returns {boolean} true if the word is dirty
|
|
174
174
|
*/
|
|
175
175
|
update(dt) {
|
package/src/plugin/plugin.js
CHANGED
|
@@ -44,9 +44,9 @@ export var plugin = {
|
|
|
44
44
|
* @name patch
|
|
45
45
|
* @memberof plugin
|
|
46
46
|
* @public
|
|
47
|
-
* @param {object} proto target object
|
|
48
|
-
* @param {string} name target function
|
|
49
|
-
* @param {Function} fn replacement function
|
|
47
|
+
* @param {object} proto - target object
|
|
48
|
+
* @param {string} name - target function
|
|
49
|
+
* @param {Function} fn - replacement function
|
|
50
50
|
* @example
|
|
51
51
|
* // redefine the me.game.update function with a new one
|
|
52
52
|
* me.plugin.patch(me.game, "update", function () {
|
|
@@ -89,9 +89,9 @@ export var plugin = {
|
|
|
89
89
|
* @memberof plugin
|
|
90
90
|
* @see Base
|
|
91
91
|
* @public
|
|
92
|
-
* @param {plugin.Base} pluginObj Plugin object to instantiate and register
|
|
92
|
+
* @param {plugin.Base} pluginObj - Plugin object to instantiate and register
|
|
93
93
|
* @param {string} name
|
|
94
|
-
* @param {object} [...arguments] all extra parameters will be passed to the plugin constructor
|
|
94
|
+
* @param {object} [...arguments] - all extra parameters will be passed to the plugin constructor
|
|
95
95
|
* @example
|
|
96
96
|
* // register a new plugin
|
|
97
97
|
* me.plugin.register(TestPlugin, "testPlugin");
|
|
@@ -10,9 +10,9 @@ import pool from "./../system/pooling.js";
|
|
|
10
10
|
*/
|
|
11
11
|
class Collectable extends Sprite {
|
|
12
12
|
/**
|
|
13
|
-
* @param {number} x the x coordinates of the collectable
|
|
14
|
-
* @param {number} y the y coordinates of the collectable
|
|
15
|
-
* @param {object} settings See {@link Sprite}
|
|
13
|
+
* @param {number} x - the x coordinates of the collectable
|
|
14
|
+
* @param {number} y - the y coordinates of the collectable
|
|
15
|
+
* @param {object} settings - See {@link Sprite}
|
|
16
16
|
*/
|
|
17
17
|
constructor(x, y, settings) {
|
|
18
18
|
|
|
@@ -9,9 +9,9 @@ import Renderable from "./renderable.js";
|
|
|
9
9
|
*/
|
|
10
10
|
class ColorLayer extends Renderable {
|
|
11
11
|
/**
|
|
12
|
-
* @param {string} name Layer name
|
|
13
|
-
* @param {Color|string} color CSS color
|
|
14
|
-
* @param {number} [z = 0] z-index position
|
|
12
|
+
* @param {string} name - Layer name
|
|
13
|
+
* @param {Color|string} color - CSS color
|
|
14
|
+
* @param {number} [z = 0] - z-index position
|
|
15
15
|
*/
|
|
16
16
|
constructor(name, color, z) {
|
|
17
17
|
// parent constructor
|
|
@@ -44,8 +44,8 @@ class ColorLayer extends Renderable {
|
|
|
44
44
|
* @name draw
|
|
45
45
|
* @memberof ColorLayer
|
|
46
46
|
* @protected
|
|
47
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
48
|
-
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
47
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer - a renderer instance
|
|
48
|
+
* @param {Camera2d} [viewport] - the viewport to (re)draw
|
|
49
49
|
*/
|
|
50
50
|
draw(renderer, viewport) {
|
|
51
51
|
renderer.save();
|