melonjs 14.0.2 → 14.1.1

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 (219) hide show
  1. package/README.md +2 -0
  2. package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +10 -0
  3. package/dist/melonjs.mjs/_virtual/arraymultimap.js +10 -0
  4. package/dist/melonjs.mjs/_virtual/earcut.js +10 -0
  5. package/dist/melonjs.mjs/_virtual/howler.js +10 -0
  6. package/dist/melonjs.mjs/_virtual/index.js +10 -0
  7. package/dist/melonjs.mjs/_virtual/index2.js +10 -0
  8. package/dist/melonjs.mjs/_virtual/multimap.js +10 -0
  9. package/dist/melonjs.mjs/_virtual/setmultimap.js +10 -0
  10. package/dist/melonjs.mjs/application/application.js +238 -0
  11. package/dist/melonjs.mjs/audio/audio.js +536 -0
  12. package/dist/melonjs.mjs/camera/camera2d.js +731 -0
  13. package/dist/melonjs.mjs/entity/entity.js +247 -0
  14. package/dist/melonjs.mjs/game.js +29 -0
  15. package/dist/melonjs.mjs/geometries/ellipse.js +274 -0
  16. package/dist/melonjs.mjs/geometries/line.js +115 -0
  17. package/dist/melonjs.mjs/geometries/path2d.js +318 -0
  18. package/dist/melonjs.mjs/geometries/point.js +88 -0
  19. package/dist/melonjs.mjs/geometries/poly.js +498 -0
  20. package/dist/melonjs.mjs/geometries/rectangle.js +374 -0
  21. package/dist/melonjs.mjs/geometries/roundrect.js +167 -0
  22. package/dist/melonjs.mjs/index.js +248 -0
  23. package/dist/melonjs.mjs/input/gamepad.js +501 -0
  24. package/dist/melonjs.mjs/input/input.js +26 -0
  25. package/dist/melonjs.mjs/input/keyboard.js +470 -0
  26. package/dist/melonjs.mjs/input/pointer.js +393 -0
  27. package/dist/melonjs.mjs/input/pointerevent.js +818 -0
  28. package/dist/melonjs.mjs/lang/deprecated.js +157 -0
  29. package/dist/melonjs.mjs/level/level.js +297 -0
  30. package/dist/melonjs.mjs/level/tiled/TMXGroup.js +141 -0
  31. package/dist/melonjs.mjs/level/tiled/TMXLayer.js +446 -0
  32. package/dist/melonjs.mjs/level/tiled/TMXObject.js +355 -0
  33. package/dist/melonjs.mjs/level/tiled/TMXTile.js +193 -0
  34. package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +636 -0
  35. package/dist/melonjs.mjs/level/tiled/TMXTileset.js +309 -0
  36. package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +81 -0
  37. package/dist/melonjs.mjs/level/tiled/TMXUtils.js +367 -0
  38. package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +504 -0
  39. package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +218 -0
  40. package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +155 -0
  41. package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +124 -0
  42. package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +107 -0
  43. package/dist/melonjs.mjs/loader/loader.js +801 -0
  44. package/dist/melonjs.mjs/loader/loadingscreen.js +120 -0
  45. package/dist/melonjs.mjs/loader/melonjs_logo.png.js +11 -0
  46. package/dist/melonjs.mjs/math/color.js +616 -0
  47. package/dist/melonjs.mjs/math/math.js +218 -0
  48. package/dist/melonjs.mjs/math/matrix2.js +501 -0
  49. package/dist/melonjs.mjs/math/matrix3.js +679 -0
  50. package/dist/melonjs.mjs/math/observable_vector2.js +469 -0
  51. package/dist/melonjs.mjs/math/observable_vector3.js +559 -0
  52. package/dist/melonjs.mjs/math/vector2.js +526 -0
  53. package/dist/melonjs.mjs/math/vector3.js +567 -0
  54. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +73 -0
  55. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +21 -0
  56. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +324 -0
  57. package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +69 -0
  58. package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +691 -0
  59. package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +350 -0
  60. package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3241 -0
  61. package/dist/melonjs.mjs/particles/emitter.js +265 -0
  62. package/dist/melonjs.mjs/particles/particle.js +186 -0
  63. package/dist/melonjs.mjs/particles/settings.js +319 -0
  64. package/dist/melonjs.mjs/physics/body.js +702 -0
  65. package/dist/melonjs.mjs/physics/bounds.js +459 -0
  66. package/dist/melonjs.mjs/physics/collision.js +132 -0
  67. package/dist/melonjs.mjs/physics/detector.js +194 -0
  68. package/dist/melonjs.mjs/physics/quadtree.js +394 -0
  69. package/dist/melonjs.mjs/physics/response.js +57 -0
  70. package/dist/melonjs.mjs/physics/sat.js +483 -0
  71. package/dist/melonjs.mjs/physics/world.js +219 -0
  72. package/dist/melonjs.mjs/plugin/plugin.js +141 -0
  73. package/dist/melonjs.mjs/renderable/collectable.js +60 -0
  74. package/dist/melonjs.mjs/renderable/colorlayer.js +78 -0
  75. package/dist/melonjs.mjs/renderable/container.js +1016 -0
  76. package/dist/melonjs.mjs/renderable/dragndrop.js +224 -0
  77. package/dist/melonjs.mjs/renderable/imagelayer.js +305 -0
  78. package/dist/melonjs.mjs/renderable/light2d.js +155 -0
  79. package/dist/melonjs.mjs/renderable/nineslicesprite.js +246 -0
  80. package/dist/melonjs.mjs/renderable/renderable.js +781 -0
  81. package/dist/melonjs.mjs/renderable/sprite.js +653 -0
  82. package/dist/melonjs.mjs/renderable/trigger.js +156 -0
  83. package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +212 -0
  84. package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +225 -0
  85. package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +127 -0
  86. package/dist/melonjs.mjs/state/stage.js +236 -0
  87. package/dist/melonjs.mjs/state/state.js +596 -0
  88. package/dist/melonjs.mjs/system/device.js +909 -0
  89. package/dist/melonjs.mjs/system/dom.js +78 -0
  90. package/dist/melonjs.mjs/system/event.js +537 -0
  91. package/dist/melonjs.mjs/system/platform.js +41 -0
  92. package/dist/melonjs.mjs/system/pooling.js +209 -0
  93. package/dist/melonjs.mjs/system/save.js +157 -0
  94. package/dist/melonjs.mjs/system/timer.js +286 -0
  95. package/dist/melonjs.mjs/text/bitmaptext.js +363 -0
  96. package/dist/melonjs.mjs/text/bitmaptextdata.js +198 -0
  97. package/dist/melonjs.mjs/text/glyph.js +65 -0
  98. package/dist/melonjs.mjs/text/text.js +452 -0
  99. package/dist/melonjs.mjs/text/textmetrics.js +175 -0
  100. package/dist/melonjs.mjs/text/textstyle.js +23 -0
  101. package/dist/melonjs.mjs/tweens/easing.js +336 -0
  102. package/dist/melonjs.mjs/tweens/interpolation.js +112 -0
  103. package/dist/melonjs.mjs/tweens/tween.js +479 -0
  104. package/dist/melonjs.mjs/utils/agent.js +76 -0
  105. package/dist/melonjs.mjs/utils/array.js +63 -0
  106. package/dist/melonjs.mjs/utils/file.js +42 -0
  107. package/dist/melonjs.mjs/utils/function.js +70 -0
  108. package/dist/melonjs.mjs/utils/string.js +82 -0
  109. package/dist/melonjs.mjs/utils/utils.js +173 -0
  110. package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +806 -0
  111. package/dist/melonjs.mjs/video/renderer.js +410 -0
  112. package/dist/melonjs.mjs/video/texture/atlas.js +519 -0
  113. package/dist/melonjs.mjs/video/texture/cache.js +143 -0
  114. package/dist/melonjs.mjs/video/texture/canvas_texture.js +144 -0
  115. package/dist/melonjs.mjs/video/video.js +462 -0
  116. package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +142 -0
  117. package/dist/melonjs.mjs/video/webgl/glshader.js +167 -0
  118. package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +10 -0
  119. package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +10 -0
  120. package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +10 -0
  121. package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +10 -0
  122. package/dist/melonjs.mjs/video/webgl/utils/attributes.js +25 -0
  123. package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -0
  124. package/dist/melonjs.mjs/video/webgl/utils/program.js +67 -0
  125. package/dist/melonjs.mjs/video/webgl/utils/string.js +25 -0
  126. package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +92 -0
  127. package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +494 -0
  128. package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1035 -0
  129. package/dist/melonjs.module.d.ts +1298 -1359
  130. package/dist/melonjs.module.js +2072 -3520
  131. package/package.json +21 -16
  132. package/src/application/application.js +4 -5
  133. package/src/audio/audio.js +32 -32
  134. package/src/camera/camera2d.js +32 -33
  135. package/src/entity/entity.js +18 -19
  136. package/src/geometries/ellipse.js +17 -18
  137. package/src/geometries/line.js +6 -7
  138. package/src/geometries/path2d.js +33 -34
  139. package/src/geometries/point.js +1 -2
  140. package/src/geometries/poly.js +16 -18
  141. package/src/geometries/rectangle.js +19 -20
  142. package/src/geometries/roundrect.js +9 -10
  143. package/src/input/gamepad.js +15 -15
  144. package/src/input/keyboard.js +12 -12
  145. package/src/input/pointer.js +6 -6
  146. package/src/input/pointerevent.js +12 -12
  147. package/src/lang/deprecated.js +12 -12
  148. package/src/level/level.js +25 -25
  149. package/src/level/tiled/TMXLayer.js +23 -24
  150. package/src/level/tiled/TMXTile.js +6 -7
  151. package/src/level/tiled/TMXTileMap.js +8 -10
  152. package/src/level/tiled/TMXTileset.js +3 -4
  153. package/src/level/tiled/TMXTilesetGroup.js +1 -2
  154. package/src/level/tiled/TMXUtils.js +5 -5
  155. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
  156. package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
  157. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
  158. package/src/level/tiled/renderer/TMXRenderer.js +20 -21
  159. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -2
  160. package/src/loader/loader.js +20 -20
  161. package/src/math/color.js +21 -22
  162. package/src/math/math.js +16 -16
  163. package/src/math/matrix2.js +17 -18
  164. package/src/math/matrix3.js +26 -27
  165. package/src/math/observable_vector2.js +15 -16
  166. package/src/math/observable_vector3.js +17 -18
  167. package/src/math/vector2.js +10 -11
  168. package/src/math/vector3.js +11 -12
  169. package/src/particles/emitter.js +7 -8
  170. package/src/particles/particle.js +3 -4
  171. package/src/physics/body.js +29 -30
  172. package/src/physics/bounds.js +10 -10
  173. package/src/physics/collision.js +2 -2
  174. package/src/physics/detector.js +6 -6
  175. package/src/physics/quadtree.js +18 -23
  176. package/src/physics/sat.js +31 -31
  177. package/src/physics/world.js +6 -7
  178. package/src/plugin/plugin.js +5 -5
  179. package/src/renderable/collectable.js +4 -6
  180. package/src/renderable/colorlayer.js +6 -8
  181. package/src/renderable/container.js +25 -27
  182. package/src/renderable/dragndrop.js +14 -14
  183. package/src/renderable/imagelayer.js +14 -15
  184. package/src/renderable/light2d.js +4 -5
  185. package/src/renderable/nineslicesprite.js +17 -18
  186. package/src/renderable/renderable.js +26 -28
  187. package/src/renderable/sprite.js +29 -30
  188. package/src/renderable/trigger.js +16 -17
  189. package/src/renderable/ui/uibaseelement.js +8 -9
  190. package/src/renderable/ui/uispriteelement.js +8 -8
  191. package/src/renderable/ui/uitextbutton.js +15 -15
  192. package/src/state/stage.js +8 -9
  193. package/src/state/state.js +17 -17
  194. package/src/system/device.js +11 -11
  195. package/src/system/event.js +10 -10
  196. package/src/system/pooling.js +9 -9
  197. package/src/system/save.js +2 -2
  198. package/src/system/timer.js +10 -10
  199. package/src/text/bitmaptext.js +19 -20
  200. package/src/text/bitmaptextdata.js +3 -4
  201. package/src/text/glyph.js +1 -2
  202. package/src/text/text.js +24 -25
  203. package/src/text/textmetrics.js +9 -10
  204. package/src/tweens/tween.js +20 -21
  205. package/src/utils/agent.js +5 -5
  206. package/src/utils/array.js +4 -4
  207. package/src/utils/file.js +2 -2
  208. package/src/utils/function.js +6 -6
  209. package/src/utils/string.js +5 -5
  210. package/src/utils/utils.js +4 -4
  211. package/src/video/canvas/canvas_renderer.js +72 -73
  212. package/src/video/renderer.js +27 -28
  213. package/src/video/texture/atlas.js +22 -22
  214. package/src/video/texture/canvas_texture.js +9 -9
  215. package/src/video/video.js +17 -17
  216. package/src/video/webgl/buffer/vertex.js +1 -2
  217. package/src/video/webgl/glshader.js +12 -12
  218. package/src/video/webgl/webgl_compositor.js +42 -43
  219. package/src/video/webgl/webgl_renderer.js +76 -77
@@ -5,10 +5,10 @@ import pool from "./../system/pooling.js";
5
5
  * @classdesc
6
6
  * a generic 2D Vector Object
7
7
  */
8
- class Vector2d {
8
+ export default class Vector2d {
9
9
  /**
10
- * @param {number} [x=0] x value of the vector
11
- * @param {number} [y=0] y value of the vector
10
+ * @param {number} [x=0] - x value of the vector
11
+ * @param {number} [y=0] - y value of the vector
12
12
  */
13
13
  constructor(x = 0, y = 0) {
14
14
  this.onResetEvent(x, y);
@@ -159,7 +159,7 @@ class Vector2d {
159
159
  * Divide this vector values by the passed value
160
160
  * @name div
161
161
  * @memberof Vector2d
162
- * @param {number} n the value to divide the vector by
162
+ * @param {number} n - the value to divide the vector by
163
163
  * @returns {Vector2d} Reference to this object for method chaining
164
164
  */
165
165
  div(n) {
@@ -348,8 +348,8 @@ class Vector2d {
348
348
  * Rotate this vector (counter-clockwise) by the specified angle (in radians).
349
349
  * @name rotate
350
350
  * @memberof Vector2d
351
- * @param {number} angle The angle to rotate (in radians)
352
- * @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
351
+ * @param {number} angle - The angle to rotate (in radians)
352
+ * @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around
353
353
  * @returns {Vector2d} Reference to this object for method chaining
354
354
  */
355
355
  rotate(angle, v) {
@@ -417,7 +417,7 @@ class Vector2d {
417
417
  * @name lerp
418
418
  * @memberof Vector2d
419
419
  * @param {Vector2d} v
420
- * @param {number} alpha distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
420
+ * @param {number} alpha - distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
421
421
  * @returns {Vector2d} Reference to this object for method chaining
422
422
  */
423
423
  lerp(v, alpha) {
@@ -431,7 +431,7 @@ class Vector2d {
431
431
  * @name moveTowards
432
432
  * @memberof Vector2d
433
433
  * @param {Vector2d} target
434
- * @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
434
+ * @param {number} step - the maximum step per iteration (Negative values will push the vector away from the target)
435
435
  * @returns {Vector2d} Reference to this object for method chaining
436
436
  */
437
437
  moveTowards(target, step) {
@@ -476,7 +476,7 @@ class Vector2d {
476
476
  * project this vector on to another vector.
477
477
  * @name project
478
478
  * @memberof Vector2d
479
- * @param {Vector2d} v The vector to project onto.
479
+ * @param {Vector2d} v - The vector to project onto.
480
480
  * @returns {Vector2d} Reference to this object for method chaining
481
481
  */
482
482
  project(v) {
@@ -488,7 +488,7 @@ class Vector2d {
488
488
  * This is slightly more efficient than `project` when dealing with unit vectors.
489
489
  * @name projectN
490
490
  * @memberof Vector2d
491
- * @param {Vector2d} v The unit vector to project onto.
491
+ * @param {Vector2d} v - The unit vector to project onto.
492
492
  * @returns {Vector2d} Reference to this object for method chaining
493
493
  */
494
494
  projectN(v) {
@@ -516,4 +516,3 @@ class Vector2d {
516
516
  }
517
517
  }
518
518
 
519
- export default Vector2d;
@@ -5,11 +5,11 @@ import pool from "./../system/pooling.js";
5
5
  * @classdesc
6
6
  * a generic 3D Vector Object
7
7
  */
8
- class Vector3d {
8
+ export default class Vector3d {
9
9
  /**
10
- * @param {number} [x=0] x value of the vector
11
- * @param {number} [y=0] y value of the vector
12
- * @param {number} [z=0] z value of the vector
10
+ * @param {number} [x=0] - x value of the vector
11
+ * @param {number} [y=0] - y value of the vector
12
+ * @param {number} [z=0] - z value of the vector
13
13
  */
14
14
  constructor(x = 0, y = 0, z = 0) {
15
15
  this.onResetEvent(x, y, z);
@@ -174,7 +174,7 @@ class Vector3d {
174
174
  * Divide this vector values by the passed value
175
175
  * @name div
176
176
  * @memberof Vector3d
177
- * @param {number} n the value to divide the vector by
177
+ * @param {number} n - the value to divide the vector by
178
178
  * @returns {Vector3d} Reference to this object for method chaining
179
179
  */
180
180
  div(n) {
@@ -373,8 +373,8 @@ class Vector3d {
373
373
  * Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
374
374
  * @name rotate
375
375
  * @memberof Vector3d
376
- * @param {number} angle The angle to rotate (in radians)
377
- * @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around (on the same z axis)
376
+ * @param {number} angle - The angle to rotate (in radians)
377
+ * @param {Vector2d|ObservableVector2d} [v] - an optional point to rotate around (on the same z axis)
378
378
  * @returns {Vector3d} Reference to this object for method chaining
379
379
  */
380
380
  rotate(angle, v) {
@@ -450,7 +450,7 @@ class Vector3d {
450
450
  * @name lerp
451
451
  * @memberof Vector3d
452
452
  * @param {Vector3d} v
453
- * @param {number} alpha distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
453
+ * @param {number} alpha - distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
454
454
  * @returns {Vector3d} Reference to this object for method chaining
455
455
  */
456
456
  lerp(v, alpha) {
@@ -465,7 +465,7 @@ class Vector3d {
465
465
  * @name moveTowards
466
466
  * @memberof Vector3d
467
467
  * @param {Vector2d|Vector3d} target
468
- * @param {number} step the maximum step per iteration (Negative values will push the vector away from the target)
468
+ * @param {number} step - the maximum step per iteration (Negative values will push the vector away from the target)
469
469
  * @returns {Vector3d} Reference to this object for method chaining
470
470
  */
471
471
  moveTowards(target, step) {
@@ -515,7 +515,7 @@ class Vector3d {
515
515
  * project this vector on to another vector.
516
516
  * @name project
517
517
  * @memberof Vector3d
518
- * @param {Vector2d|Vector3d} v The vector to project onto.
518
+ * @param {Vector2d|Vector3d} v - The vector to project onto.
519
519
  * @returns {Vector3d} Reference to this object for method chaining
520
520
  */
521
521
  project(v) {
@@ -528,7 +528,7 @@ class Vector3d {
528
528
  * This is slightly more efficient than `project` when dealing with unit vectors.
529
529
  * @name projectN
530
530
  * @memberof Vector3d
531
- * @param {Vector2d|Vector3d} v The unit vector to project onto.
531
+ * @param {Vector2d|Vector3d} v - The unit vector to project onto.
532
532
  * @returns {Vector3d} Reference to this object for method chaining
533
533
  */
534
534
  projectN(v) {
@@ -557,4 +557,3 @@ class Vector3d {
557
557
  }
558
558
  }
559
559
 
560
- export default Vector3d;
@@ -21,11 +21,11 @@ function createDefaultParticleTexture(w = 8, h = 8) {
21
21
  * Particle Emitter Object.
22
22
  * @augments Container
23
23
  */
24
- class ParticleEmitter extends Container {
24
+ export default 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;
@@ -256,4 +256,3 @@ class ParticleEmitter extends Container {
256
256
  }
257
257
  }
258
258
 
259
- export default ParticleEmitter;
@@ -8,9 +8,9 @@ import Renderable from "./../renderable/renderable.js";
8
8
  * Single Particle Object.
9
9
  * @augments Renderable
10
10
  */
11
- class Particle extends Renderable {
11
+ export default 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
@@ -176,4 +176,3 @@ class Particle extends Renderable {
176
176
  }
177
177
  }
178
178
 
179
- export default Particle;
@@ -14,11 +14,11 @@ import Point from "../geometries/point.js";
14
14
  * a Generic Physic Body Object with some physic properties and behavior functionality, to as a member of a Renderable.
15
15
  * @see Renderable.body
16
16
  */
17
- class Body {
17
+ export default 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
@@ -692,4 +692,3 @@ class Body {
692
692
  }
693
693
  }
694
694
 
695
- export default Body;
@@ -5,9 +5,9 @@ import Vector2d from "./../math/vector2.js";
5
5
  * @classdesc
6
6
  * a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
7
7
  */
8
- class Bounds {
8
+ export default 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");
@@ -448,4 +448,4 @@ class Bounds {
448
448
  }
449
449
 
450
450
  }
451
- export default Bounds;
451
+
@@ -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
@@ -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
@@ -1,5 +1,4 @@
1
1
  import Vector2d from "./../math/vector2.js";
2
- import Container from "./../renderable/container.js";
3
2
  import * as arrayUtil from "./../utils/array.js";
4
3
 
5
4
  /*
@@ -8,7 +7,6 @@ import * as arrayUtil from "./../utils/array.js";
8
7
  * https://github.com/timohausmann/quadtree-js/
9
8
  **/
10
9
 
11
-
12
10
  /**
13
11
  * a pool of `QuadTree` objects
14
12
  * @ignore
@@ -53,13 +51,13 @@ var QT_VECTOR = new Vector2d();
53
51
  * a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
54
52
  * @see game.world.broadphase
55
53
  */
56
- class QuadTree {
54
+ export default class QuadTree {
57
55
  /**
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
56
+ * @param {World} world - the physic world this QuadTree belongs to
57
+ * @param {Bounds} bounds - bounds of the node
58
+ * @param {number} [max_objects=4] - max objects a node can hold before splitting into 4 subnodes
59
+ * @param {number} [max_levels=4] - total max levels inside root Quadtree
60
+ * @param {number} [level] - deepth level, required for subnodes
63
61
  */
64
62
  constructor(world, bounds, max_objects = 4, max_levels = 4, level = 0) {
65
63
 
@@ -70,7 +68,6 @@ class QuadTree {
70
68
  this.max_levels = max_levels;
71
69
 
72
70
  this.level = level;
73
- this.bounds = bounds;
74
71
 
75
72
  this.objects = [];
76
73
  this.nodes = [];
@@ -89,7 +86,7 @@ class QuadTree {
89
86
  //top right node
90
87
  this.nodes[0] = QT_ARRAY_POP(
91
88
  this.world,
92
- this.bounds, {
89
+ {
93
90
  left : left + subWidth,
94
91
  top : top,
95
92
  width : subWidth,
@@ -103,7 +100,7 @@ class QuadTree {
103
100
  //top left node
104
101
  this.nodes[1] = QT_ARRAY_POP(
105
102
  this.world,
106
- this.bounds, {
103
+ {
107
104
  left : left,
108
105
  top: top,
109
106
  width : subWidth,
@@ -117,7 +114,7 @@ class QuadTree {
117
114
  //bottom left node
118
115
  this.nodes[2] = QT_ARRAY_POP(
119
116
  this.world,
120
- this.bounds, {
117
+ {
121
118
  left : left,
122
119
  top : top + subHeight,
123
120
  width : subWidth,
@@ -131,7 +128,7 @@ class QuadTree {
131
128
  //bottom right node
132
129
  this.nodes[3] = QT_ARRAY_POP(
133
130
  this.world,
134
- this.bounds, {
131
+ {
135
132
  left : left + subWidth,
136
133
  top : top + subHeight,
137
134
  width : subWidth,
@@ -156,7 +153,7 @@ class QuadTree {
156
153
  if (item.isFloating === true) {
157
154
  pos = this.world.app.viewport.localToWorld(bounds.left, bounds.top, QT_VECTOR);
158
155
  } else {
159
- pos = QT_VECTOR.set(bounds.left, bounds.top);
156
+ pos = QT_VECTOR.set(item.left, item.top);
160
157
  }
161
158
 
162
159
  var index = -1,
@@ -194,12 +191,12 @@ class QuadTree {
194
191
  * Insert the given object container into the node.
195
192
  * @name insertContainer
196
193
  * @memberof QuadTree
197
- * @param {Container} container group of objects to be added
194
+ * @param {Container} container - group of objects to be added
198
195
  */
199
196
  insertContainer(container) {
200
197
  for (var i = container.children.length, child; i--, (child = container.children[i]);) {
201
198
  if (child.isKinematic !== true) {
202
- if (child instanceof Container) {
199
+ if (typeof child.addChild === "function") {
203
200
  if (child.name !== "rootContainer") {
204
201
  this.insert(child);
205
202
  }
@@ -222,7 +219,7 @@ class QuadTree {
222
219
  * objects to their corresponding subnodes.
223
220
  * @name insert
224
221
  * @memberof QuadTree
225
- * @param {object} item object to be added
222
+ * @param {object} item - object to be added
226
223
  */
227
224
  insert(item) {
228
225
  var index = -1;
@@ -266,8 +263,8 @@ class QuadTree {
266
263
  * Return all objects that could collide with the given object
267
264
  * @name retrieve
268
265
  * @memberof QuadTree
269
- * @param {object} item object to be checked against
270
- * @param {object} [fn] a sorting function for the returned array
266
+ * @param {object} item - object to be checked against
267
+ * @param {object} [fn] - a sorting function for the returned array
271
268
  * @returns {object[]} array with all detected objects
272
269
  */
273
270
  retrieve(item, fn) {
@@ -301,7 +298,7 @@ class QuadTree {
301
298
  * (this function won't recalculate the impacted node)
302
299
  * @name remove
303
300
  * @memberof QuadTree
304
- * @param {object} item object to be removed
301
+ * @param {object} item - object to be removed
305
302
  * @returns {boolean} true if the item was found and removed.
306
303
  */
307
304
  remove(item) {
@@ -367,7 +364,7 @@ class QuadTree {
367
364
  * clear the quadtree
368
365
  * @name clear
369
366
  * @memberof QuadTree
370
- * @param {Bounds} [bounds=this.bounds] the bounds to be cleared
367
+ * @param {Bounds} [bounds=this.bounds] - the bounds to be cleared
371
368
  */
372
369
  clear(bounds) {
373
370
  this.objects.length = 0;
@@ -386,5 +383,3 @@ class QuadTree {
386
383
  }
387
384
  }
388
385
  }
389
-
390
- export default QuadTree;