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
@@ -51,10 +51,10 @@ function safeLoadLevel(levelId, options, restart) {
51
51
  * @name loadTMXLevel
52
52
  * @memberof level
53
53
  * @private
54
- * @param {string} levelId level id
55
- * @param {Container} container target container
56
- * @param {boolean} [flatten=true] if true, flatten all objects into the given container
57
- * @param {boolean} [setViewportBounds=false] if true, set the viewport bounds to the map size, this should be set to true especially if adding a level to the game world container.
54
+ * @param {string} levelId - level id
55
+ * @param {Container} container - target container
56
+ * @param {boolean} [flatten=true] - if true, flatten all objects into the given container
57
+ * @param {boolean} [setViewportBounds=false] - if true, set the viewport bounds to the map size, this should be set to true especially if adding a level to the game world container.
58
58
  * @ignore
59
59
  */
60
60
  function loadTMXLevel(levelId, container, flatten, setViewportBounds) {
@@ -84,9 +84,9 @@ var level = {
84
84
  * @name add
85
85
  * @memberof level
86
86
  * @public
87
- * @param {string} format level format (only "tmx" supported)
88
- * @param {string} levelId the level id (or name)
89
- * @param {Function} [callback] a function to be called once the level is loaded
87
+ * @param {string} format - level format (only "tmx" supported)
88
+ * @param {string} levelId - the level id (or name)
89
+ * @param {Function} [callback] - a function to be called once the level is loaded
90
90
  * @returns {boolean} true if the level was loaded
91
91
  */
92
92
  add(format, levelId, callback) {
@@ -122,12 +122,12 @@ var level = {
122
122
  * @name load
123
123
  * @memberof level
124
124
  * @public
125
- * @param {string} levelId level id
126
- * @param {object} [options] additional optional parameters
127
- * @param {Container} [options.container=game.world] container in which to load the specified level
128
- * @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
129
- * @param {boolean} [options.flatten=game.mergeGroup] if true, flatten all objects into the given container
130
- * @param {boolean} [options.setViewportBounds=true] if true, set the viewport bounds to the map size
125
+ * @param {string} levelId - level id
126
+ * @param {object} [options] - additional optional parameters
127
+ * @param {Container} [options.container=game.world] - container in which to load the specified level
128
+ * @param {Function} [options.onLoaded=game.onLevelLoaded] - callback for when the level is fully loaded
129
+ * @param {boolean} [options.flatten=game.mergeGroup] - if true, flatten all objects into the given container
130
+ * @param {boolean} [options.setViewportBounds=true] - if true, set the viewport bounds to the map size
131
131
  * @returns {boolean} true if the level was successfully loaded
132
132
  * @example
133
133
  * // the game assets to be be preloaded
@@ -219,10 +219,10 @@ var level = {
219
219
  * @name reload
220
220
  * @memberof level
221
221
  * @public
222
- * @param {object} [options] additional optional parameters
223
- * @param {Container} [options.container=game.world] container in which to load the specified level
224
- * @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
225
- * @param {boolean} [options.flatten=game.mergeGroup] if true, flatten all objects into the given container
222
+ * @param {object} [options] - additional optional parameters
223
+ * @param {Container} [options.container=game.world] - container in which to load the specified level
224
+ * @param {Function} [options.onLoaded=game.onLevelLoaded] - callback for when the level is fully loaded
225
+ * @param {boolean} [options.flatten=game.mergeGroup] - if true, flatten all objects into the given container
226
226
  * @returns {object} the current level
227
227
  */
228
228
  reload(options) {
@@ -236,10 +236,10 @@ var level = {
236
236
  * @name next
237
237
  * @memberof level
238
238
  * @public
239
- * @param {object} [options] additional optional parameters
240
- * @param {Container} [options.container=game.world] container in which to load the specified level
241
- * @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
242
- * @param {boolean} [options.flatten=game.mergeGroup] if true, flatten all objects into the given container
239
+ * @param {object} [options] - additional optional parameters
240
+ * @param {Container} [options.container=game.world] - container in which to load the specified level
241
+ * @param {Function} [options.onLoaded=game.onLevelLoaded] - callback for when the level is fully loaded
242
+ * @param {boolean} [options.flatten=game.mergeGroup] - if true, flatten all objects into the given container
243
243
  * @returns {boolean} true if the next level was successfully loaded
244
244
  */
245
245
  next(options) {
@@ -257,10 +257,10 @@ var level = {
257
257
  * @name previous
258
258
  * @memberof level
259
259
  * @public
260
- * @param {object} [options] additional optional parameters
261
- * @param {Container} [options.container=game.world] container in which to load the specified level
262
- * @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
263
- * @param {boolean} [options.flatten=game.mergeGroup] if true, flatten all objects into the given container
260
+ * @param {object} [options] - additional optional parameters
261
+ * @param {Container} [options.container=game.world] - container in which to load the specified level
262
+ * @param {Function} [options.onLoaded=game.onLevelLoaded] - callback for when the level is fully loaded
263
+ * @param {boolean} [options.flatten=game.mergeGroup] - if true, flatten all objects into the given container
264
264
  * @returns {boolean} true if the previous level was successfully loaded
265
265
  */
266
266
  previous(options) {
@@ -68,15 +68,15 @@ function preRenderLayer(layer, renderer) {
68
68
  * Tiled QT 0.7.x format
69
69
  * @augments Renderable
70
70
  */
71
- class TMXLayer extends Renderable {
71
+ export default class TMXLayer extends Renderable {
72
72
  /**
73
- * @param {object} map layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
74
- * @param {object} data layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
75
- * @param {number} tilewidth width of each tile in pixels
76
- * @param {number} tileheight height of each tile in pixels
77
- * @param {string} orientation "isometric" or "orthogonal"
78
- * @param {TMXTilesetGroup} tilesets tileset as defined in Tiled
79
- * @param {number} z z-index position
73
+ * @param {object} map - layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
74
+ * @param {object} data - layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
75
+ * @param {number} tilewidth - width of each tile in pixels
76
+ * @param {number} tileheight - height of each tile in pixels
77
+ * @param {string} orientation - "isometric" or "orthogonal"
78
+ * @param {TMXTilesetGroup} tilesets - tileset as defined in Tiled
79
+ * @param {number} z - z-index position
80
80
  */
81
81
  constructor(map, data, tilewidth, tileheight, orientation, tilesets, z) {
82
82
  // super constructor
@@ -278,8 +278,8 @@ class TMXLayer extends Renderable {
278
278
  * @name getTileId
279
279
  * @memberof TMXLayer
280
280
  * @public
281
- * @param {number} x X coordinate (in world/pixels coordinates)
282
- * @param {number} y Y coordinate (in world/pixels coordinates)
281
+ * @param {number} x - X coordinate (in world/pixels coordinates)
282
+ * @param {number} y - Y coordinate (in world/pixels coordinates)
283
283
  * @returns {number} TileId or null if there is no Tile at the given position
284
284
  */
285
285
  getTileId(x, y) {
@@ -292,8 +292,8 @@ class TMXLayer extends Renderable {
292
292
  * @name getTile
293
293
  * @memberof TMXLayer
294
294
  * @public
295
- * @param {number} x X coordinate (in world/pixels coordinates)
296
- * @param {number} y Y coordinate (in world/pixels coordinates)
295
+ * @param {number} x - X coordinate (in world/pixels coordinates)
296
+ * @param {number} y - Y coordinate (in world/pixels coordinates)
297
297
  * @returns {Tile} corresponding tile or null if there is no defined tile at the coordinate or if outside of the layer bounds
298
298
  * @example
299
299
  * // get the TMX Map Layer called "Front layer"
@@ -317,9 +317,9 @@ class TMXLayer extends Renderable {
317
317
  * @name getTile
318
318
  * @memberof TMXLayer
319
319
  * @public
320
- * @param {Tile} tile the tile object to be assigned
321
- * @param {number} x x coordinate (in world/pixels coordinates)
322
- * @param {number} y y coordinate (in world/pixels coordinates)
320
+ * @param {Tile} tile - the tile object to be assigned
321
+ * @param {number} x - x coordinate (in world/pixels coordinates)
322
+ * @param {number} y - y coordinate (in world/pixels coordinates)
323
323
  * @returns {Tile} the tile object
324
324
  */
325
325
  setTile(tile, x, y) {
@@ -332,9 +332,9 @@ class TMXLayer extends Renderable {
332
332
  * @name setTile
333
333
  * @memberof TMXLayer
334
334
  * @public
335
- * @param {number} tileId tileId
336
- * @param {number} x X coordinate (in world/pixels coordinates)
337
- * @param {number} y Y coordinate (in world/pixels coordinates)
335
+ * @param {number} tileId - tileId
336
+ * @param {number} x - X coordinate (in world/pixels coordinates)
337
+ * @param {number} y - Y coordinate (in world/pixels coordinates)
338
338
  * @returns {Tile} the tile object
339
339
  */
340
340
  getTileById(tileId, x, y) {
@@ -350,9 +350,9 @@ class TMXLayer extends Renderable {
350
350
  * @name cellAt
351
351
  * @memberof TMXLayer
352
352
  * @public
353
- * @param {number} x x position of the tile (in Tile unit)
354
- * @param {number} y x position of the tile (in Tile unit)
355
- * @param {number} [boundsCheck=true] check first if within the layer bounds
353
+ * @param {number} x - x position of the tile (in Tile unit)
354
+ * @param {number} y - x position of the tile (in Tile unit)
355
+ * @param {number} [boundsCheck=true] - check first if within the layer bounds
356
356
  * @returns {Tile} corresponding tile or null if there is no defined tile at the position or if outside of the layer bounds
357
357
  * @example
358
358
  * // return the first tile at offset 0, 0
@@ -376,8 +376,8 @@ class TMXLayer extends Renderable {
376
376
  * @name clearTile
377
377
  * @memberof TMXLayer
378
378
  * @public
379
- * @param {number} x X coordinate (in map coordinates: row/column)
380
- * @param {number} y Y coordinate (in map coordinates: row/column)
379
+ * @param {number} x - X coordinate (in map coordinates: row/column)
380
+ * @param {number} y - Y coordinate (in map coordinates: row/column)
381
381
  * @example
382
382
  * me.game.world.getChildByType(me.TMXLayer).forEach(function(layer) {
383
383
  * // clear all tiles at the given x,y coordinates
@@ -436,4 +436,3 @@ class TMXLayer extends Renderable {
436
436
  }
437
437
  }
438
438
 
439
- export default TMXLayer;
@@ -13,12 +13,12 @@ const TMX_FLIP_H = 0x80000000,
13
13
  * a basic tile object
14
14
  * @augments Bounds
15
15
  */
16
- class Tile extends Bounds {
16
+ export default class Tile extends Bounds {
17
17
  /**
18
- * @param {number} x x index of the Tile in the map
19
- * @param {number} y y index of the Tile in the map
20
- * @param {number} gid tile gid
21
- * @param {TMXTileset} tileset the corresponding tileset object
18
+ * @param {number} x - x index of the Tile in the map
19
+ * @param {number} y - y index of the Tile in the map
20
+ * @param {number} gid - tile gid
21
+ * @param {TMXTileset} tileset - the corresponding tileset object
22
22
  */
23
23
  constructor(x, y, gid, tileset) {
24
24
  var width, height;
@@ -132,7 +132,7 @@ class Tile extends Bounds {
132
132
  * return a renderable object for this Tile object
133
133
  * @name Tile#getRenderable
134
134
  * @public
135
- * @param {object} [settings] see {@link Sprite}
135
+ * @param {object} [settings] - see {@link Sprite}
136
136
  * @returns {Renderable} a me.Sprite object
137
137
  */
138
138
  getRenderable(settings) {
@@ -182,4 +182,3 @@ class Tile extends Bounds {
182
182
  return renderable;
183
183
  }
184
184
  }
185
- export default Tile;
@@ -12,7 +12,6 @@ import TMXTilesetGroup from "./TMXTilesetGroup.js";
12
12
  import TMXGroup from "./TMXGroup.js";
13
13
  import TMXLayer from "./TMXLayer.js";
14
14
  import { applyTMXProperties } from "./TMXUtils.js";
15
- import Renderable from "./../../renderable/renderable.js";
16
15
  import Container from "./../../renderable/container.js";
17
16
 
18
17
  // constant to identify the collision object layer
@@ -103,10 +102,10 @@ function readObjectGroup(map, data, z) {
103
102
  * a TMX Tile Map Object
104
103
  * Tiled QT +0.7.x format
105
104
  */
106
- class TMXTileMap {
105
+ export default class TMXTileMap {
107
106
  /**
108
- * @param {string} levelId name of TMX map
109
- * @param {object} data TMX map in JSON format
107
+ * @param {string} levelId - name of TMX map
108
+ * @param {object} data - TMX map in JSON format
110
109
  * @example
111
110
  * // create a new level object based on the TMX JSON object
112
111
  * var level = new me.TMXTileMap(levelId, me.loader.getTMX(levelId));
@@ -361,9 +360,9 @@ class TMXTileMap {
361
360
  * note : this will not automatically update the camera viewport
362
361
  * @name TMXTileMap#addTo
363
362
  * @public
364
- * @param {Container} container target container
365
- * @param {boolean} [flatten=true] if true, flatten all objects into the given container, else a `me.Container` object will be created for each corresponding groups
366
- * @param {boolean} [setViewportBounds=false] if true, set the viewport bounds to the map size, this should be set to true especially if adding a level to the game world container.
363
+ * @param {Container} container - target container
364
+ * @param {boolean} [flatten=true] - if true, flatten all objects into the given container, else a `me.Container` object will be created for each corresponding groups
365
+ * @param {boolean} [setViewportBounds=false] - if true, set the viewport bounds to the map size, this should be set to true especially if adding a level to the game world container.
367
366
  * @example
368
367
  * // create a new level object based on the TMX JSON object
369
368
  * var level = new me.TMXTileMap(levelId, me.loader.getTMX(levelId));
@@ -437,7 +436,7 @@ class TMXTileMap {
437
436
  * return an Array of instantiated objects, based on the map object definition
438
437
  * @name TMXTileMap#getObjects
439
438
  * @public
440
- * @param {boolean} [flatten=true] if true, flatten all objects into the returned array.
439
+ * @param {boolean} [flatten=true] - if true, flatten all objects into the returned array.
441
440
  * when false, a `me.Container` object will be created for each corresponding groups
442
441
  * @returns {Renderable[]} Array of Objects
443
442
  */
@@ -578,7 +577,7 @@ class TMXTileMap {
578
577
  if (obj.isRenderable === true) {
579
578
  obj.setOpacity(obj.getOpacity() * group.opacity);
580
579
  // and to child renderables if any
581
- if (obj.renderable instanceof Renderable) {
580
+ if (typeof obj.renderable !== "undefined" && obj.renderable.isRenderable === true) {
582
581
  obj.renderable.setOpacity(obj.renderable.getOpacity() * group.opacity);
583
582
  }
584
583
  }
@@ -630,4 +629,3 @@ class TMXTileMap {
630
629
  }
631
630
  }
632
631
 
633
- export default TMXTileMap;
@@ -8,9 +8,9 @@ import loader from "./../../loader/loader.js";
8
8
  * @classdesc
9
9
  * a TMX Tile Set Object
10
10
  */
11
- class TMXTileset {
11
+ export default class TMXTileset {
12
12
  /**
13
- * @param {object} tileset tileset data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#tileset})
13
+ * @param {object} tileset - tileset data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#tileset})
14
14
  */
15
15
  constructor(tileset) {
16
16
  var i = 0;
@@ -206,7 +206,7 @@ class TMXTileset {
206
206
  * Get the view (local) tile ID from a GID, with animations applied
207
207
  * @name TMXTileset#getViewTileId
208
208
  * @public
209
- * @param {number} gid Global tile ID
209
+ * @param {number} gid - Global tile ID
210
210
  * @returns {number} View tile ID
211
211
  */
212
212
  getViewTileId(gid) {
@@ -299,4 +299,3 @@ class TMXTileset {
299
299
  }
300
300
  }
301
301
 
302
- export default TMXTileset;
@@ -6,7 +6,7 @@ const TMX_CLEAR_BIT_MASK = ~(0x80000000 | 0x40000000 | 0x20000000);
6
6
  * @classdesc
7
7
  * an object containing all tileset
8
8
  */
9
- class TMXTilesetGroup {
9
+ export default class TMXTilesetGroup {
10
10
 
11
11
  constructor() {
12
12
  this.tilesets = [];
@@ -72,4 +72,3 @@ class TMXTilesetGroup {
72
72
  }
73
73
  }
74
74
 
75
- export default TMXTilesetGroup;
@@ -99,8 +99,8 @@ function parseAttributes(obj, elt) {
99
99
  * decompress zlib/gzip data (NOT IMPLEMENTED)
100
100
  * @ignore
101
101
  * @name decompress
102
- * @param {number[]} data Array of bytes
103
- * @param {string} format compressed data format ("gzip","zlib")
102
+ * @param {number[]} data- - Array of bytes
103
+ * @param {string} format- - compressed data format ("gzip","zlib")
104
104
  */
105
105
  export function decompress() {
106
106
  throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!");
@@ -110,7 +110,7 @@ export function decompress() {
110
110
  * Decode a CSV encoded array into a binary array
111
111
  * @ignore
112
112
  * @name decodeCSV
113
- * @param {string} input CSV formatted data (only numbers, everything else will be converted to NaN)
113
+ * @param {string} input- - CSV formatted data (only numbers, everything else will be converted to NaN)
114
114
  * @returns {number[]} Decoded data
115
115
  */
116
116
  export function decodeCSV(input) {
@@ -127,8 +127,8 @@ export function decodeCSV(input) {
127
127
  * Decode a base64 encoded string into a byte array
128
128
  * @ignore
129
129
  * @name decodeBase64AsArray
130
- * @param {string} input Base64 encoded data
131
- * @param {number} [bytes] number of bytes per array entry
130
+ * @param {string} input - Base64 encoded data
131
+ * @param {number} [bytes] - number of bytes per array entry
132
132
  * @returns {Uint32Array} Decoded data
133
133
  */
134
134
  export function decodeBase64AsArray(input, bytes) {
@@ -24,9 +24,9 @@ const offsetsStaggerY = [
24
24
  * an Hexagonal Map Renderder
25
25
  * @augments TMXRenderer
26
26
  */
27
- class TMXHexagonalRenderer extends TMXRenderer {
27
+ export default class TMXHexagonalRenderer extends TMXRenderer {
28
28
  /**
29
- * @param {TMXTileMap} map the TMX map
29
+ * @param {TMXTileMap} map - the TMX map
30
30
  */
31
31
  constructor(map) {
32
32
  super(
@@ -81,7 +81,7 @@ class TMXHexagonalRenderer extends TMXRenderer {
81
81
  * return the bounding rect for this map renderer
82
82
  * @name TMXHexagonalRenderer#getBounds
83
83
  * @public
84
- * @param {TMXLayer} [layer] calculate the bounding rect for a specific layer (will return a new bounds object)
84
+ * @param {TMXLayer} [layer] - calculate the bounding rect for a specific layer (will return a new bounds object)
85
85
  * @returns {Bounds}
86
86
  */
87
87
  getBounds(layer) {
@@ -496,4 +496,3 @@ class TMXHexagonalRenderer extends TMXRenderer {
496
496
  }
497
497
  }
498
498
 
499
- export default TMXHexagonalRenderer;
@@ -9,9 +9,9 @@ import TMXLayer from "./../TMXLayer.js";
9
9
  * an Isometric Map Renderder
10
10
  * @augments TMXRenderer
11
11
  */
12
- class TMXIsometricRenderer extends TMXRenderer {
12
+ export default class TMXIsometricRenderer extends TMXRenderer {
13
13
  /**
14
- * @param {TMXTileMap} map the TMX map
14
+ * @param {TMXTileMap} map - the TMX map
15
15
  */
16
16
  constructor(map) {
17
17
  super(
@@ -41,7 +41,7 @@ class TMXIsometricRenderer extends TMXRenderer {
41
41
  * return the bounding rect for this map renderer
42
42
  * @name TMXIsometricRenderer#getBounds
43
43
  * @public
44
- * @param {TMXLayer} [layer] calculate the bounding rect for a specific layer (will return a new bounds object)
44
+ * @param {TMXLayer} [layer] - calculate the bounding rect for a specific layer (will return a new bounds object)
45
45
  * @returns {Bounds}
46
46
  */
47
47
  getBounds(layer) {
@@ -209,4 +209,3 @@ class TMXIsometricRenderer extends TMXRenderer {
209
209
  }
210
210
  }
211
211
 
212
- export default TMXIsometricRenderer;
@@ -7,9 +7,9 @@ import TMXRenderer from "./TMXRenderer.js";
7
7
  * an Orthogonal Map Renderder
8
8
  * @augments TMXRenderer
9
9
  */
10
- class TMXOrthogonalRenderer extends TMXRenderer {
10
+ export default class TMXOrthogonalRenderer extends TMXRenderer {
11
11
  /**
12
- * @param {TMXTileMap} map the TMX map
12
+ * @param {TMXTileMap} map - the TMX map
13
13
  */
14
14
  constructor(map) {
15
15
  super(
@@ -147,4 +147,3 @@ class TMXOrthogonalRenderer extends TMXRenderer {
147
147
  }
148
148
  }
149
149
 
150
- export default TMXOrthogonalRenderer;
@@ -8,12 +8,12 @@ import Bounds from "./../../../physics/bounds.js";
8
8
  * @classdesc
9
9
  * The map renderer base class
10
10
  */
11
- class TMXRenderer {
11
+ export default class TMXRenderer {
12
12
  /**
13
- * @param {number} cols width of the tilemap in tiles
14
- * @param {number} rows height of the tilemap in tiles
15
- * @param {number} tilewidth width of each tile in pixels
16
- * @param {number} tileheight height of each tile in pixels
13
+ * @param {number} cols - width of the tilemap in tiles
14
+ * @param {number} rows - height of the tilemap in tiles
15
+ * @param {number} tilewidth - width of each tile in pixels
16
+ * @param {number} tileheight - height of each tile in pixels
17
17
  */
18
18
  constructor(cols, rows, tilewidth, tileheight) {
19
19
  this.cols = cols;
@@ -27,7 +27,7 @@ class TMXRenderer {
27
27
  * return true if the renderer can render the specified map or layer
28
28
  * @name TMXRenderer#canRender
29
29
  * @public
30
- * @param {TMXTileMap|TMXLayer} component TMX Map or Layer
30
+ * @param {TMXTileMap|TMXLayer} component - TMX Map or Layer
31
31
  * @returns {boolean}
32
32
  */
33
33
  canRender(component) {
@@ -47,7 +47,7 @@ class TMXRenderer {
47
47
  * return the bounding rect for this map renderer
48
48
  * @name TMXRenderer#getBounds
49
49
  * @public
50
- * @param {TMXLayer} [layer] calculate the bounding rect for a specific layer (will return a new bounds object)
50
+ * @param {TMXLayer} [layer] - calculate the bounding rect for a specific layer (will return a new bounds object)
51
51
  * @returns {Bounds}
52
52
  */
53
53
  getBounds(layer) {
@@ -64,9 +64,9 @@ class TMXRenderer {
64
64
  * return the tile position corresponding to the specified pixel
65
65
  * @name TMXRenderer#pixelToTileCoords
66
66
  * @public
67
- * @param {number} x X coordinate
68
- * @param {number} y Y coordinate
69
- * @param {Vector2d} [v] an optional vector object where to put the return values
67
+ * @param {number} x - X coordinate
68
+ * @param {number} y - Y coordinate
69
+ * @param {Vector2d} [v] - an optional vector object where to put the return values
70
70
  * @returns {Vector2d}
71
71
  */
72
72
  pixelToTileCoords(x, y, v) {
@@ -77,9 +77,9 @@ class TMXRenderer {
77
77
  * return the pixel position corresponding of the specified tile
78
78
  * @name TMXRenderer#tileToPixelCoords
79
79
  * @public
80
- * @param {number} col tile horizontal position
81
- * @param {number} row tile vertical position
82
- * @param {Vector2d} [v] an optional vector object where to put the return values
80
+ * @param {number} col - tile horizontal position
81
+ * @param {number} row - tile vertical position
82
+ * @param {Vector2d} [v] - an optional vector object where to put the return values
83
83
  * @returns {Vector2d}
84
84
  */
85
85
  tileToPixelCoords(col, row, v) {
@@ -90,10 +90,10 @@ class TMXRenderer {
90
90
  * draw the given tile at the specified layer
91
91
  * @name TMXRenderer#drawTile
92
92
  * @public
93
- * @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
94
- * @param {number} x X coordinate where to draw the tile
95
- * @param {number} y Y coordinate where to draw the tile
96
- * @param {Tile} tile the tile object to draw
93
+ * @param {CanvasRenderer|WebGLRenderer} renderer - a renderer object
94
+ * @param {number} x - X coordinate where to draw the tile
95
+ * @param {number} y - Y coordinate where to draw the tile
96
+ * @param {Tile} tile - the tile object to draw
97
97
  */
98
98
  drawTile(renderer, x, y, tile) {
99
99
  }
@@ -102,15 +102,14 @@ class TMXRenderer {
102
102
  * draw the given TMX Layer for the given area
103
103
  * @name TMXRenderer#drawTileLayer
104
104
  * @public
105
- * @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
106
- * @param {TMXLayer} layer a TMX Layer object
107
- * @param {Rect} rect the area of the layer to draw
105
+ * @param {CanvasRenderer|WebGLRenderer} renderer - a renderer object
106
+ * @param {TMXLayer} layer - a TMX Layer object
107
+ * @param {Rect} rect - the area of the layer to draw
108
108
  */
109
109
  drawTileLayer(renderer, layer, rect) {
110
110
  }
111
111
 
112
112
  }
113
113
 
114
- export default TMXRenderer;
115
114
 
116
115
  /* eslint-enable no-unused-vars */
@@ -9,7 +9,7 @@ import { degToRad } from "./../../../math/math.js";
9
9
  * a Staggered Map Renderder
10
10
  * @augments TMXHexagonalRenderer
11
11
  */
12
- class TMXStaggeredRenderer extends TMXHexagonalRenderer {
12
+ export default class TMXStaggeredRenderer extends TMXHexagonalRenderer {
13
13
 
14
14
  /**
15
15
  * return true if the renderer can render the specified layer
@@ -98,4 +98,3 @@ class TMXStaggeredRenderer extends TMXHexagonalRenderer {
98
98
  }
99
99
  }
100
100
 
101
- export default TMXStaggeredRenderer;
@@ -441,8 +441,8 @@ var loader = {
441
441
  * @name setBaseURL
442
442
  * @memberof loader
443
443
  * @public
444
- * @param {string} type "*", "audio", binary", "image", "json", "js", "tmx", "tsx"
445
- * @param {string} [url="./"] default base URL
444
+ * @param {string} type - "*", "audio", binary", "image", "json", "js", "tmx", "tsx"
445
+ * @param {string} [url="./"] - default base URL
446
446
  * @example
447
447
  * // change the base URL relative address for audio assets
448
448
  * me.loader.setBaseURL("audio", "data/audio/");
@@ -472,12 +472,12 @@ var loader = {
472
472
  * @memberof loader
473
473
  * @public
474
474
  * @param {object[]} res
475
- * @param {string} res.name internal name of the resource
476
- * @param {string} res.type "audio", binary", "image", "json","js", "tmx", "tsx", "fontface"
477
- * @param {string} res.src path and/or file name of the resource (for audio assets only the path is required)
478
- * @param {boolean} [res.stream] Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
479
- * @param {Function} [onload=loader.onload] function to be called when all resources are loaded
480
- * @param {boolean} [switchToLoadState=true] automatically switch to the loading screen
475
+ * @param {string} res.name - internal name of the resource
476
+ * @param {string} res.type - "audio", binary", "image", "json","js", "tmx", "tsx", "fontface"
477
+ * @param {string} res.src - path and/or file name of the resource (for audio assets only the path is required)
478
+ * @param {boolean} [res.stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
479
+ * @param {Function} [onload=loader.onload] - function to be called when all resources are loaded
480
+ * @param {boolean} [switchToLoadState=true] - automatically switch to the loading screen
481
481
  * @example
482
482
  * game_resources = [
483
483
  * // PNG tileset
@@ -540,12 +540,12 @@ var loader = {
540
540
  * @memberof loader
541
541
  * @public
542
542
  * @param {object} res
543
- * @param {string} res.name internal name of the resource
544
- * @param {string} res.type "audio", binary", "image", "json", "tmx", "tsx"
545
- * @param {string} res.src path and/or file name of the resource (for audio assets only the path is required)
546
- * @param {boolean} [res.stream] Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
547
- * @param {Function} [onload] function to be called when the resource is loaded
548
- * @param {Function} [onerror] function to be called in case of error
543
+ * @param {string} res.name - internal name of the resource
544
+ * @param {string} res.type - "audio", binary", "image", "json", "tmx", "tsx"
545
+ * @param {string} res.src - path and/or file name of the resource (for audio assets only the path is required)
546
+ * @param {boolean} [res.stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
547
+ * @param {Function} [onload] - function to be called when the resource is loaded
548
+ * @param {Function} [onerror] - function to be called in case of error
549
549
  * @returns {number} the amount of corresponding resource to be preloaded
550
550
  * @example
551
551
  * // load an image asset
@@ -610,8 +610,8 @@ var loader = {
610
610
  * @memberof loader
611
611
  * @public
612
612
  * @param {object} res
613
- * @param {string} res.name internal name of the resource
614
- * @param {string} res.type "audio", binary", "image", "json", "tmx", "tsx"
613
+ * @param {string} res.name - internal name of the resource
614
+ * @param {string} res.type - "audio", binary", "image", "json", "tmx", "tsx"
615
615
  * @returns {boolean} true if unloaded
616
616
  * @example me.loader.unload({name: "avatar", type:"image"});
617
617
  */
@@ -724,7 +724,7 @@ var loader = {
724
724
  * @name getTMX
725
725
  * @memberof loader
726
726
  * @public
727
- * @param {string} elt name of the tmx/tsx element ("map1");
727
+ * @param {string} elt - name of the tmx/tsx element ("map1");
728
728
  * @returns {object} requested element or null if not found
729
729
  */
730
730
  getTMX(elt) {
@@ -741,7 +741,7 @@ var loader = {
741
741
  * @name getBinary
742
742
  * @memberof loader
743
743
  * @public
744
- * @param {string} elt name of the binary object ("ymTrack");
744
+ * @param {string} elt - name of the binary object ("ymTrack");
745
745
  * @returns {object} requested element or null if not found
746
746
  */
747
747
  getBinary(elt) {
@@ -758,7 +758,7 @@ var loader = {
758
758
  * @name getImage
759
759
  * @memberof loader
760
760
  * @public
761
- * @param {string} image name of the Image element ("tileset-platformer");
761
+ * @param {string} image - name of the Image element ("tileset-platformer");
762
762
  * @returns {HTMLImageElement} requested element or null if not found
763
763
  */
764
764
  getImage(image) {
@@ -776,7 +776,7 @@ var loader = {
776
776
  * @name getJSON
777
777
  * @memberof loader
778
778
  * @public
779
- * @param {string} elt name of the json file to load
779
+ * @param {string} elt - name of the json file to load
780
780
  * @returns {object}
781
781
  */
782
782
  getJSON(elt) {