melonjs 10.2.1 → 10.2.2

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 (90) hide show
  1. package/README.md +1 -1
  2. package/dist/melonjs.js +2735 -2760
  3. package/dist/melonjs.min.js +3 -3
  4. package/dist/melonjs.module.d.ts +2186 -2162
  5. package/dist/melonjs.module.js +2323 -2362
  6. package/package.json +8 -9
  7. package/src/audio/audio.js +43 -43
  8. package/src/camera/camera2d.js +52 -74
  9. package/src/entity/draggable.js +18 -17
  10. package/src/entity/droptarget.js +19 -18
  11. package/src/entity/entity.js +22 -26
  12. package/src/game.js +2 -2
  13. package/src/index.js +11 -11
  14. package/src/input/gamepad.js +13 -13
  15. package/src/input/input.js +1 -1
  16. package/src/input/keyboard.js +14 -16
  17. package/src/input/pointer.js +42 -35
  18. package/src/input/pointerevent.js +18 -26
  19. package/src/lang/deprecated.js +3 -3
  20. package/src/level/level.js +24 -16
  21. package/src/level/tiled/TMXGroup.js +6 -6
  22. package/src/level/tiled/TMXLayer.js +31 -31
  23. package/src/level/tiled/TMXObject.js +19 -19
  24. package/src/level/tiled/TMXTile.js +11 -12
  25. package/src/level/tiled/TMXTileMap.js +23 -21
  26. package/src/level/tiled/TMXTileset.js +13 -13
  27. package/src/level/tiled/TMXTilesetGroup.js +4 -4
  28. package/src/level/tiled/TMXUtils.js +13 -11
  29. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  30. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  31. package/src/level/tiled/renderer/TMXRenderer.js +17 -17
  32. package/src/loader/loader.js +29 -25
  33. package/src/math/color.js +45 -64
  34. package/src/math/math.js +17 -17
  35. package/src/math/matrix2.js +46 -46
  36. package/src/math/matrix3.js +64 -64
  37. package/src/math/observable_vector2.js +45 -57
  38. package/src/math/observable_vector3.js +56 -70
  39. package/src/math/vector2.js +60 -59
  40. package/src/math/vector3.js +65 -64
  41. package/src/particles/emitter.js +53 -55
  42. package/src/particles/particle.js +1 -1
  43. package/src/physics/body.js +44 -44
  44. package/src/physics/bounds.js +34 -34
  45. package/src/physics/collision.js +15 -16
  46. package/src/physics/detector.js +10 -10
  47. package/src/physics/quadtree.js +19 -17
  48. package/src/physics/sat.js +17 -17
  49. package/src/physics/world.js +12 -10
  50. package/src/plugin/plugin.js +6 -6
  51. package/src/renderable/GUI.js +13 -18
  52. package/src/renderable/collectable.js +3 -3
  53. package/src/renderable/colorlayer.js +4 -4
  54. package/src/renderable/container.js +64 -46
  55. package/src/renderable/imagelayer.js +30 -31
  56. package/src/renderable/nineslicesprite.js +13 -13
  57. package/src/renderable/renderable.js +68 -66
  58. package/src/renderable/sprite.js +57 -43
  59. package/src/renderable/trigger.js +14 -15
  60. package/src/shapes/ellipse.js +27 -26
  61. package/src/shapes/line.js +8 -7
  62. package/src/shapes/poly.js +33 -31
  63. package/src/shapes/rectangle.js +50 -96
  64. package/src/state/stage.js +6 -6
  65. package/src/state/state.js +54 -54
  66. package/src/system/device.js +97 -84
  67. package/src/system/event.js +72 -72
  68. package/src/system/pooling.js +14 -14
  69. package/src/system/save.js +6 -3
  70. package/src/system/timer.js +20 -20
  71. package/src/text/bitmaptext.js +27 -33
  72. package/src/text/bitmaptextdata.js +9 -9
  73. package/src/text/text.js +39 -41
  74. package/src/tweens/easing.js +4 -4
  75. package/src/tweens/interpolation.js +4 -4
  76. package/src/tweens/tween.js +37 -27
  77. package/src/utils/agent.js +9 -8
  78. package/src/utils/array.js +4 -4
  79. package/src/utils/file.js +4 -4
  80. package/src/utils/function.js +5 -5
  81. package/src/utils/string.js +12 -12
  82. package/src/utils/utils.js +19 -19
  83. package/src/video/canvas/canvas_renderer.js +90 -90
  84. package/src/video/renderer.js +40 -39
  85. package/src/video/texture.js +74 -75
  86. package/src/video/video.js +30 -30
  87. package/src/video/webgl/buffer/vertex.js +9 -1
  88. package/src/video/webgl/glshader.js +20 -20
  89. package/src/video/webgl/webgl_compositor.js +33 -34
  90. package/src/video/webgl/webgl_renderer.js +104 -104
@@ -1,6 +1,5 @@
1
1
  import {preventDefault} from "./input.js";
2
2
  import {getBindingKey, triggerKeyEvent} from "./keyboard.js";
3
- import Vector2d from "./../math/vector2.js";
4
3
  import { renderer, scaleRatio } from "./../video/video.js";
5
4
  import * as fctUtil from "./../utils/function.js";
6
5
  import * as arrayUtil from "./../utils/array.js";
@@ -11,13 +10,11 @@ import device from "./../system/device.js";
11
10
  import Pointer from "./pointer.js";
12
11
  import Rect from "./../shapes/rectangle.js";
13
12
  import Container from "./../renderable/container.js";
14
- import Renderable from "./../renderable/renderable.js";
15
13
  import { world, viewport } from "./../game.js";
16
14
 
17
-
18
15
  /**
19
16
  * A pool of `Pointer` objects to cache pointer/touch event coordinates.
20
- * @type {Array.<Vector>}
17
+ * @type {Array.<me.Vector2d>}
21
18
  * @ignore
22
19
  */
23
20
  var T_POINTERS = [];
@@ -292,7 +289,7 @@ function dispatchEvent(normalizedEvents) {
292
289
  var bounds = region.getBounds();
293
290
  var eventInBounds = false;
294
291
 
295
- if (region.floating === true) {
292
+ if (region.isFloating === true) {
296
293
  pointer.gameX = pointer.gameLocalX = pointer.gameScreenX;
297
294
  pointer.gameY = pointer.gameLocalY = pointer.gameScreenY;
298
295
  } else {
@@ -308,10 +305,11 @@ function dispatchEvent(normalizedEvents) {
308
305
  pointer.gameLocalY = pointer.gameY - parentBounds.y;
309
306
  }
310
307
 
308
+ var gameX = pointer.gameX;
309
+ var gameY = pointer.gameY;
310
+
311
311
  // apply inverse transformation for renderable
312
- if (region instanceof Renderable) {
313
- var gameX = pointer.gameX;
314
- var gameY = pointer.gameY;
312
+ if (typeof region.currentTransform !== "undefined") {
315
313
  if (!region.currentTransform.isIdentity()) {
316
314
  var invV = region.currentTransform.applyInverse(
317
315
  pool.pull("Vector2d", gameX, gameY)
@@ -320,14 +318,8 @@ function dispatchEvent(normalizedEvents) {
320
318
  gameY = invV.y;
321
319
  pool.push(invV);
322
320
  }
323
- eventInBounds = bounds.contains(gameX, gameY);
324
- } else {
325
- eventInBounds =
326
- bounds.contains(pointer.gameX, pointer.gameY) &&
327
- (bounds === region ||
328
- // if the given target is another shape than me.Rect
329
- region.contains(pointer.gameLocalX, pointer.gameLocalY));
330
321
  }
322
+ eventInBounds = bounds.contains(gameX, gameY);
331
323
 
332
324
  switch (pointer.type) {
333
325
  case POINTER_MOVE[0]:
@@ -498,7 +490,7 @@ function onPointerEvent(e) {
498
490
  /**
499
491
  * the default target element for pointer events (usually the canvas element in which the game is rendered)
500
492
  * @public
501
- * @type EventTarget
493
+ * @type {EventTarget}
502
494
  * @name pointerEventTarget
503
495
  * @memberOf me.input
504
496
  */
@@ -518,7 +510,7 @@ export var pointer = new Pointer(0, 0, 1, 1);
518
510
  * default value : "1000/me.timer.maxfps" ms<br>
519
511
  * set to 0 ms to disable the feature
520
512
  * @public
521
- * @type Number
513
+ * @type {number}
522
514
  * @name throttlingInterval
523
515
  * @memberOf me.input
524
516
  */
@@ -531,10 +523,10 @@ export var throttlingInterval;
531
523
  * @memberOf me.input
532
524
  * @public
533
525
  * @function
534
- * @param {Number} x the global x coordinate to be translated.
535
- * @param {Number} y the global y coordinate to be translated.
526
+ * @param {number} x the global x coordinate to be translated.
527
+ * @param {number} y the global y coordinate to be translated.
536
528
  * @param {me.Vector2d} [v] an optional vector object where to set the translated coordinates
537
- * @return {me.Vector2d} A vector object with the corresponding translated coordinates
529
+ * @returns {me.Vector2d} A vector object with the corresponding translated coordinates
538
530
  * @example
539
531
  * onMouseEvent : function (pointer) {
540
532
  * // convert the given into local (viewport) relative coordinates
@@ -543,7 +535,7 @@ export var throttlingInterval;
543
535
  * };
544
536
  */
545
537
  export function globalToLocal(x, y, v) {
546
- v = v || new Vector2d();
538
+ v = v || pool.pull("Vector2d");
547
539
  var rect = device.getElementBounds(renderer.getScreenCanvas());
548
540
  var pixelRatio = device.devicePixelRatio;
549
541
  x -= rect.left + (window.pageXOffset || 0);
@@ -565,7 +557,7 @@ export function globalToLocal(x, y, v) {
565
557
  * @public
566
558
  * @function
567
559
  * @param {HTMLCanvasElement} element
568
- * @param {String} [value="none"]
560
+ * @param {string} [value="none"]
569
561
  */
570
562
  export function setTouchAction(element, value) {
571
563
  element.style["touch-action"] = value || "none";
@@ -580,7 +572,7 @@ export function setTouchAction(element, value) {
580
572
  * @memberOf me.input
581
573
  * @public
582
574
  * @function
583
- * @param {Number} [button=me.input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
575
+ * @param {number} [button=me.input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
584
576
  * @param {me.input.KEY} keyCode
585
577
  * @example
586
578
  * // enable the keyboard
@@ -611,7 +603,7 @@ export function bindPointer() {
611
603
  * @memberOf me.input
612
604
  * @public
613
605
  * @function
614
- * @param {Number} [button=me.input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
606
+ * @param {number} [button=me.input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
615
607
  * @example
616
608
  * me.input.unbindPointer(me.input.pointer.LEFT);
617
609
  */
@@ -633,7 +625,7 @@ export function unbindPointer(button) {
633
625
  * @memberOf me.input
634
626
  * @public
635
627
  * @function
636
- * @param {String} eventType The event type for which the object is registering <br>
628
+ * @param {string} eventType The event type for which the object is registering <br>
637
629
  * melonJS currently supports: <br>
638
630
  * <ul>
639
631
  * <li><code>"pointermove"</code></li>
@@ -705,7 +697,7 @@ export function registerPointerEvent(eventType, region, callback) {
705
697
  * @memberOf me.input
706
698
  * @public
707
699
  * @function
708
- * @param {String} eventType The event type for which the object was registered. See {@link me.input.registerPointerEvent}
700
+ * @param {string} eventType The event type for which the object was registered. See {@link me.input.registerPointerEvent}
709
701
  * @param {me.Rect|me.Polygon|me.Line|me.Ellipse} region the registered region to release for this event
710
702
  * @param {Function} [callback="all"] if specified unregister the event only for the specific callback
711
703
  * @example
@@ -10,9 +10,9 @@
10
10
  * @function
11
11
  * @memberOf me.deprecated
12
12
  * @name warning
13
- * @param {String} deprecated deprecated class,function or property name
14
- * @param {String} replacement the replacement class, function, or property name
15
- * @param {String} version the version since when the lass,function or property is deprecated
13
+ * @param {string} deprecated deprecated class,function or property name
14
+ * @param {string} replacement the replacement class, function, or property name
15
+ * @param {string} version the version since when the lass,function or property is deprecated
16
16
  */
17
17
  export function warning(deprecated, replacement, version) {
18
18
  var msg = "melonJS: %s is deprecated since version %s, please use %s";
@@ -13,6 +13,9 @@ var levelIdx = [];
13
13
  // current level index
14
14
  var currentLevelIdx = 0;
15
15
 
16
+ /**
17
+ * @ignore
18
+ */
16
19
  function safeLoadLevel(levelId, options, restart) {
17
20
  // clean the destination container
18
21
  options.container.reset();
@@ -48,8 +51,8 @@ function safeLoadLevel(levelId, options, restart) {
48
51
  * @name loadTMXLevel
49
52
  * @memberOf me.level
50
53
  * @private
51
- * @param {String} level level id
52
- * @param {me.Container} target container
54
+ * @param {string} levelId level id
55
+ * @param {me.Container} container target container
53
56
  * @param {boolean} [flatten=true] if true, flatten all objects into the given container
54
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.
55
58
  * @ignore
@@ -84,10 +87,10 @@ var level = {
84
87
  * @memberOf me.level
85
88
  * @public
86
89
  * @function
87
- * @param {String} format level format (only "tmx" supported)
88
- * @param {String} levelId the level id (or name)
90
+ * @param {string} format level format (only "tmx" supported)
91
+ * @param {string} levelId the level id (or name)
89
92
  * @param {Function} [callback] a function to be called once the level is loaded
90
- * @return {Boolean} true if the level was loaded
93
+ * @returns {boolean} true if the level was loaded
91
94
  */
92
95
  add(format, levelId, callback) {
93
96
  switch (format) {
@@ -123,12 +126,13 @@ var level = {
123
126
  * @memberOf me.level
124
127
  * @public
125
128
  * @function
126
- * @param {String} level level id
127
- * @param {Object} [options] additional optional parameters
129
+ * @param {string} levelId level id
130
+ * @param {object} [options] additional optional parameters
128
131
  * @param {me.Container} [options.container=me.game.world] container in which to load the specified level
129
- * @param {function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
132
+ * @param {Function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
130
133
  * @param {boolean} [options.flatten=me.game.mergeGroup] if true, flatten all objects into the given container
131
134
  * @param {boolean} [options.setViewportBounds=true] if true, set the viewport bounds to the map size
135
+ * @returns {boolean} true if the level was successfully loaded
132
136
  * @example
133
137
  * // the game assets to be be preloaded
134
138
  * // TMX maps
@@ -196,7 +200,7 @@ var level = {
196
200
  * @memberOf me.level
197
201
  * @public
198
202
  * @function
199
- * @return {String}
203
+ * @returns {string}
200
204
  */
201
205
  getCurrentLevelId() {
202
206
  return levelIdx[currentLevelIdx];
@@ -210,7 +214,7 @@ var level = {
210
214
  * @memberOf me.level
211
215
  * @public
212
216
  * @function
213
- * @return {me.TMXTileMap}
217
+ * @returns {me.TMXTileMap}
214
218
  */
215
219
  getCurrentLevel() {
216
220
  return levels[this.getCurrentLevelId()];
@@ -222,10 +226,11 @@ var level = {
222
226
  * @memberOf me.level
223
227
  * @public
224
228
  * @function
225
- * @param {Object} [options] additional optional parameters
229
+ * @param {object} [options] additional optional parameters
226
230
  * @param {me.Container} [options.container=me.game.world] container in which to load the specified level
227
- * @param {function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
231
+ * @param {Function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
228
232
  * @param {boolean} [options.flatten=me.game.mergeGroup] if true, flatten all objects into the given container
233
+ * @returns {object} the current level
229
234
  */
230
235
  reload(options) {
231
236
  // reset the level to initial state
@@ -239,10 +244,11 @@ var level = {
239
244
  * @memberOf me.level
240
245
  * @public
241
246
  * @function
242
- * @param {Object} [options] additional optional parameters
247
+ * @param {object} [options] additional optional parameters
243
248
  * @param {me.Container} [options.container=me.game.world] container in which to load the specified level
244
- * @param {function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
249
+ * @param {Function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
245
250
  * @param {boolean} [options.flatten=me.game.mergeGroup] if true, flatten all objects into the given container
251
+ * @returns {boolean} true if the next level was successfully loaded
246
252
  */
247
253
  next(options) {
248
254
  //go to the next level
@@ -260,10 +266,11 @@ var level = {
260
266
  * @memberOf me.level
261
267
  * @public
262
268
  * @function
263
- * @param {Object} [options] additional optional parameters
269
+ * @param {object} [options] additional optional parameters
264
270
  * @param {me.Container} [options.container=me.game.world] container in which to load the specified level
265
- * @param {function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
271
+ * @param {Function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
266
272
  * @param {boolean} [options.flatten=me.game.mergeGroup] if true, flatten all objects into the given container
273
+ * @returns {boolean} true if the previous level was successfully loaded
267
274
  */
268
275
  previous(options) {
269
276
  // go to previous level
@@ -281,6 +288,7 @@ var level = {
281
288
  * @memberOf me.level
282
289
  * @public
283
290
  * @function
291
+ * @returns {number} the amount of level preloaded
284
292
  */
285
293
  levelCount() {
286
294
  return levelIdx.length;
@@ -18,7 +18,7 @@ export default class TMXGroup {
18
18
  /**
19
19
  * group name
20
20
  * @public
21
- * @type String
21
+ * @type {string}
22
22
  * @name name
23
23
  * @memberOf me.TMXGroup
24
24
  */
@@ -27,7 +27,7 @@ export default class TMXGroup {
27
27
  /**
28
28
  * group width
29
29
  * @public
30
- * @type Number
30
+ * @type {number}
31
31
  * @name width
32
32
  * @memberOf me.TMXGroup
33
33
  */
@@ -36,7 +36,7 @@ export default class TMXGroup {
36
36
  /**
37
37
  * group height
38
38
  * @public
39
- * @type Number
39
+ * @type {number}
40
40
  * @name height
41
41
  * @memberOf me.TMXGroup
42
42
  */
@@ -45,7 +45,7 @@ export default class TMXGroup {
45
45
  /**
46
46
  * tint color
47
47
  * @public
48
- * @type String
48
+ * @type {string}
49
49
  * @name tintcolor
50
50
  * @memberOf me.TMXGroup
51
51
  */
@@ -54,7 +54,7 @@ export default class TMXGroup {
54
54
  /**
55
55
  * group z order
56
56
  * @public
57
- * @type Number
57
+ * @type {number}
58
58
  * @name z
59
59
  * @memberOf me.TMXGroup
60
60
  */
@@ -64,7 +64,7 @@ export default class TMXGroup {
64
64
  * group objects list definition
65
65
  * @see me.TMXObject
66
66
  * @public
67
- * @type Array
67
+ * @type {object[]}
68
68
  * @name name
69
69
  * @memberOf me.TMXGroup
70
70
  */
@@ -69,13 +69,13 @@ function preRenderLayer(layer, renderer) {
69
69
  * @extends me.Renderable
70
70
  * @memberOf me
71
71
  * @constructor
72
- * @param {Object} map layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
73
- * @param {Object} data layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
74
- * @param {Number} tilewidth width of each tile in pixels
75
- * @param {Number} tileheight height of each tile in pixels
76
- * @param {String} orientation "isometric" or "orthogonal"
72
+ * @param {object} map layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
73
+ * @param {object} data layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
74
+ * @param {number} tilewidth width of each tile in pixels
75
+ * @param {number} tileheight height of each tile in pixels
76
+ * @param {string} orientation "isometric" or "orthogonal"
77
77
  * @param {me.TMXTilesetGroup} tilesets tileset as defined in Tiled
78
- * @param {Number} z z-index position
78
+ * @param {number} z z-index position
79
79
  */
80
80
  class TMXLayer extends Renderable {
81
81
  /**
@@ -95,7 +95,7 @@ class TMXLayer extends Renderable {
95
95
  /**
96
96
  * The Layer corresponding Tilesets
97
97
  * @public
98
- * @type me.TMXTilesetGroup
98
+ * @type {me.TMXTilesetGroup}
99
99
  * @name me.TMXLayer#tilesets
100
100
  */
101
101
  this.tilesets = tilesets;
@@ -118,7 +118,7 @@ class TMXLayer extends Renderable {
118
118
  /**
119
119
  * All animated tilesets in this layer
120
120
  * @ignore
121
- * @type Array
121
+ * @type {me.TMXTileset[]}
122
122
  * @name me.TMXLayer#animatedTilesets
123
123
  */
124
124
  this.animatedTilesets = [];
@@ -126,7 +126,7 @@ class TMXLayer extends Renderable {
126
126
  /**
127
127
  * Layer contains tileset animations
128
128
  * @public
129
- * @type Boolean
129
+ * @type {boolean}
130
130
  * @name me.TMXLayer#isAnimated
131
131
  */
132
132
  this.isAnimated = false;
@@ -135,7 +135,7 @@ class TMXLayer extends Renderable {
135
135
  * the order in which tiles on orthogonal tile layers are rendered.
136
136
  * (valid values are "left-down", "left-up", "right-down", "right-up")
137
137
  * @public
138
- * @type {String}
138
+ * @type {string}
139
139
  * @default "right-down"
140
140
  * @name me.TMXLayer#renderorder
141
141
  */
@@ -262,7 +262,7 @@ class TMXLayer extends Renderable {
262
262
  * @memberOf me.TMXLayer
263
263
  * @public
264
264
  * @function
265
- * @return {me.TMXRenderer} renderer
265
+ * @returns {me.TMXRenderer} renderer
266
266
  */
267
267
  getRenderer() {
268
268
  return this.renderer;
@@ -275,9 +275,9 @@ class TMXLayer extends Renderable {
275
275
  * @memberOf me.TMXLayer
276
276
  * @public
277
277
  * @function
278
- * @param {Number} x X coordinate (in world/pixels coordinates)
279
- * @param {Number} y Y coordinate (in world/pixels coordinates)
280
- * @return {Number} TileId or null if there is no Tile at the given position
278
+ * @param {number} x X coordinate (in world/pixels coordinates)
279
+ * @param {number} y Y coordinate (in world/pixels coordinates)
280
+ * @returns {number} TileId or null if there is no Tile at the given position
281
281
  */
282
282
  getTileId(x, y) {
283
283
  var tile = this.getTile(x, y);
@@ -290,9 +290,9 @@ class TMXLayer extends Renderable {
290
290
  * @memberOf me.TMXLayer
291
291
  * @public
292
292
  * @function
293
- * @param {Number} x X coordinate (in world/pixels coordinates)
294
- * @param {Number} y Y coordinate (in world/pixels coordinates)
295
- * @return {me.Tile} corresponding tile or null if there is no defined tile at the coordinate or if outside of the layer bounds
293
+ * @param {number} x X coordinate (in world/pixels coordinates)
294
+ * @param {number} y Y coordinate (in world/pixels coordinates)
295
+ * @returns {me.Tile} corresponding tile or null if there is no defined tile at the coordinate or if outside of the layer bounds
296
296
  * @example
297
297
  * // get the TMX Map Layer called "Front layer"
298
298
  * var layer = me.game.world.getChildByName("Front Layer")[0];
@@ -316,10 +316,10 @@ class TMXLayer extends Renderable {
316
316
  * @memberOf me.TMXLayer
317
317
  * @public
318
318
  * @function
319
- * @return {me.Tile} a Tile object
320
- * @param {Number} x X coordinate (in world/pixels coordinates)
321
- * @param {Number} y Y coordinate (in world/pixels coordinates)
322
- * @return {me.Tile} the tile object
319
+ * @param {me.Tile} tile the tile object to be assigned
320
+ * @param {number} x x coordinate (in world/pixels coordinates)
321
+ * @param {number} y y coordinate (in world/pixels coordinates)
322
+ * @returns {me.Tile} the tile object
323
323
  */
324
324
  setTile(tile, x, y) {
325
325
  this.layerData[x][y] = tile;
@@ -332,10 +332,10 @@ class TMXLayer extends Renderable {
332
332
  * @memberOf me.TMXLayer
333
333
  * @public
334
334
  * @function
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
- * @return {me.Tile} the tile object
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
+ * @returns {me.Tile} the tile object
339
339
  */
340
340
  getTileById(tileId, x, y) {
341
341
  if (!this.tileset.contains(tileId)) {
@@ -351,10 +351,10 @@ class TMXLayer extends Renderable {
351
351
  * @memberOf me.TMXLayer
352
352
  * @public
353
353
  * @function
354
- * @param {Number} x x position of the tile (in Tile unit)
355
- * @param {Number} y x position of the tile (in Tile unit)
356
- * @param {Number} [boundsCheck=true] check first if within the layer bounds
357
- * @return {me.Tile} corresponding tile or null if there is no defined tile at the position or if outside of the layer bounds
354
+ * @param {number} x x position of the tile (in Tile unit)
355
+ * @param {number} y x position of the tile (in Tile unit)
356
+ * @param {number} [boundsCheck=true] check first if within the layer bounds
357
+ * @returns {me.Tile} corresponding tile or null if there is no defined tile at the position or if outside of the layer bounds
358
358
  * @example
359
359
  * // return the first tile at offset 0, 0
360
360
  * var tile = layer.cellAt(0, 0);
@@ -378,8 +378,8 @@ class TMXLayer extends Renderable {
378
378
  * @memberOf me.TMXLayer
379
379
  * @public
380
380
  * @function
381
- * @param {Number} x X coordinate (in map coordinates: row/column)
382
- * @param {Number} y Y coordinate (in map coordinates: row/column)
381
+ * @param {number} x X coordinate (in map coordinates: row/column)
382
+ * @param {number} y Y coordinate (in map coordinates: row/column)
383
383
  * @example
384
384
  * me.game.world.getChildByType(me.TMXLayer).forEach(function(layer) {
385
385
  * // clear all tiles at the given x,y coordinates
@@ -20,7 +20,7 @@ export default class TMXObject {
20
20
  /**
21
21
  * point list in JSON format
22
22
  * @public
23
- * @type Object[]
23
+ * @type {object[]}
24
24
  * @name points
25
25
  * @memberOf me.TMXObject
26
26
  */
@@ -29,7 +29,7 @@ export default class TMXObject {
29
29
  /**
30
30
  * object name
31
31
  * @public
32
- * @type String
32
+ * @type {string}
33
33
  * @name name
34
34
  * @memberOf me.TMXObject
35
35
  */
@@ -38,7 +38,7 @@ export default class TMXObject {
38
38
  /**
39
39
  * object x position
40
40
  * @public
41
- * @type Number
41
+ * @type {number}
42
42
  * @name x
43
43
  * @memberOf me.TMXObject
44
44
  */
@@ -47,7 +47,7 @@ export default class TMXObject {
47
47
  /**
48
48
  * object y position
49
49
  * @public
50
- * @type Number
50
+ * @type {number}
51
51
  * @name y
52
52
  * @memberOf me.TMXObject
53
53
  */
@@ -56,7 +56,7 @@ export default class TMXObject {
56
56
  /**
57
57
  * object z order
58
58
  * @public
59
- * @type Number
59
+ * @type {number}
60
60
  * @name z
61
61
  * @memberOf me.TMXObject
62
62
  */
@@ -65,7 +65,7 @@ export default class TMXObject {
65
65
  /**
66
66
  * object width
67
67
  * @public
68
- * @type Number
68
+ * @type {number}
69
69
  * @name width
70
70
  * @memberOf me.TMXObject
71
71
  */
@@ -74,7 +74,7 @@ export default class TMXObject {
74
74
  /**
75
75
  * object height
76
76
  * @public
77
- * @type Number
77
+ * @type {number}
78
78
  * @name height
79
79
  * @memberOf me.TMXObject
80
80
  */
@@ -84,7 +84,7 @@ export default class TMXObject {
84
84
  * object gid value
85
85
  * when defined the object is a tiled object
86
86
  * @public
87
- * @type Number
87
+ * @type {number}
88
88
  * @name gid
89
89
  * @memberOf me.TMXObject
90
90
  */
@@ -93,7 +93,7 @@ export default class TMXObject {
93
93
  /**
94
94
  * tint color
95
95
  * @public
96
- * @type String
96
+ * @type {string}
97
97
  * @name tintcolor
98
98
  * @memberOf me.TMXObject
99
99
  */
@@ -102,7 +102,7 @@ export default class TMXObject {
102
102
  /**
103
103
  * object type
104
104
  * @public
105
- * @type String
105
+ * @type {string}
106
106
  * @name type
107
107
  * @memberOf me.TMXObject
108
108
  */
@@ -111,7 +111,7 @@ export default class TMXObject {
111
111
  /**
112
112
  * object text
113
113
  * @public
114
- * @type Object
114
+ * @type {object}
115
115
  * @see http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#text
116
116
  * @name type
117
117
  * @memberOf me.TMXObject
@@ -121,7 +121,7 @@ export default class TMXObject {
121
121
  /**
122
122
  * The rotation of the object in radians clockwise (defaults to 0)
123
123
  * @public
124
- * @type Number
124
+ * @type {number}
125
125
  * @name rotation
126
126
  * @memberOf me.TMXObject
127
127
  */
@@ -130,7 +130,7 @@ export default class TMXObject {
130
130
  /**
131
131
  * object unique identifier per level (Tiled 0.11.x+)
132
132
  * @public
133
- * @type Number
133
+ * @type {number}
134
134
  * @name id
135
135
  * @memberOf me.TMXObject
136
136
  */
@@ -139,7 +139,7 @@ export default class TMXObject {
139
139
  /**
140
140
  * object orientation (orthogonal or isometric)
141
141
  * @public
142
- * @type String
142
+ * @type {string}
143
143
  * @name orientation
144
144
  * @memberOf me.TMXObject
145
145
  */
@@ -148,7 +148,7 @@ export default class TMXObject {
148
148
  /**
149
149
  * the collision shapes defined for this object
150
150
  * @public
151
- * @type Array
151
+ * @type {object[]}
152
152
  * @name shapes
153
153
  * @memberOf me.TMXObject
154
154
  */
@@ -157,7 +157,7 @@ export default class TMXObject {
157
157
  /**
158
158
  * if true, the object is an Ellipse
159
159
  * @public
160
- * @type Boolean
160
+ * @type {boolean}
161
161
  * @name isEllipse
162
162
  * @memberOf me.TMXObject
163
163
  */
@@ -166,7 +166,7 @@ export default class TMXObject {
166
166
  /**
167
167
  * if true, the object is a Polygon
168
168
  * @public
169
- * @type Boolean
169
+ * @type {boolean}
170
170
  * @name isPolygon
171
171
  * @memberOf me.TMXObject
172
172
  */
@@ -175,7 +175,7 @@ export default class TMXObject {
175
175
  /**
176
176
  * if true, the object is a PolyLine
177
177
  * @public
178
- * @type Boolean
178
+ * @type {boolean}
179
179
  * @name isPolyLine
180
180
  * @memberOf me.TMXObject
181
181
  */
@@ -252,7 +252,7 @@ export default class TMXObject {
252
252
  * @memberOf me.TMXObject
253
253
  * @private
254
254
  * @function
255
- * @return {me.Polygon[]|me.Line[]|me.Ellipse[]} an array of shape objects
255
+ * @returns {me.Polygon[]|me.Line[]|me.Ellipse[]} an array of shape objects
256
256
  */
257
257
  parseTMXShapes() {
258
258
  var i = 0;