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
@@ -16,8 +16,8 @@ var pixel = (function () {
16
16
  })();
17
17
 
18
18
  /**
19
- * me.ParticleEmitterSettings contains the default settings for me.ParticleEmitter.<br>
20
- * @private
19
+ * me.ParticleEmitterSettings contains the default settings for me.ParticleEmitter
20
+ * @ignore
21
21
  * @class
22
22
  * @memberOf me
23
23
  * @see me.ParticleEmitter
@@ -26,7 +26,7 @@ var ParticleEmitterSettings = {
26
26
  /**
27
27
  * Width of the particle spawn area.<br>
28
28
  * @public
29
- * @type Number
29
+ * @type {number}
30
30
  * @name width
31
31
  * @memberOf me.ParticleEmitterSettings
32
32
  * @default 0
@@ -34,9 +34,9 @@ var ParticleEmitterSettings = {
34
34
  width : 0,
35
35
 
36
36
  /**
37
- * Height of the particle spawn area.<br>
37
+ * Height of the particle spawn area
38
38
  * @public
39
- * @type Number
39
+ * @type {number}
40
40
  * @name height
41
41
  * @memberOf me.ParticleEmitterSettings
42
42
  * @default 0
@@ -44,9 +44,9 @@ var ParticleEmitterSettings = {
44
44
  height : 0,
45
45
 
46
46
  /**
47
- * Image used for particles.<br>
47
+ * Image used for particles
48
48
  * @public
49
- * @type CanvasImageSource
49
+ * @type {CanvasImageSource}
50
50
  * @name image
51
51
  * @memberOf me.ParticleEmitterSettings
52
52
  * @default 1x1 white pixel
@@ -55,9 +55,9 @@ var ParticleEmitterSettings = {
55
55
  image : pixel,
56
56
 
57
57
  /**
58
- * Total number of particles in the emitter.<br>
58
+ * Total number of particles in the emitter
59
59
  * @public
60
- * @type Number
60
+ * @type {number}
61
61
  * @name totalParticles
62
62
  * @default 50
63
63
  * @memberOf me.ParticleEmitterSettings
@@ -65,9 +65,9 @@ var ParticleEmitterSettings = {
65
65
  totalParticles : 50,
66
66
 
67
67
  /**
68
- * Start angle for particle launch in Radians.<br>
68
+ * Start angle for particle launch in Radians
69
69
  * @public
70
- * @type Number
70
+ * @type {number}
71
71
  * @name angle
72
72
  * @default Math.PI / 2
73
73
  * @memberOf me.ParticleEmitterSettings
@@ -75,9 +75,9 @@ var ParticleEmitterSettings = {
75
75
  angle : Math.PI / 2,
76
76
 
77
77
  /**
78
- * Variation in the start angle for particle launch in Radians.<br>
78
+ * Variation in the start angle for particle launch in Radians
79
79
  * @public
80
- * @type Number
80
+ * @type {number}
81
81
  * @name angleVariation
82
82
  * @default 0
83
83
  * @memberOf me.ParticleEmitterSettings
@@ -85,9 +85,9 @@ var ParticleEmitterSettings = {
85
85
  angleVariation : 0,
86
86
 
87
87
  /**
88
- * Minimum time each particle lives once it is emitted in ms.<br>
88
+ * Minimum time each particle lives once it is emitted in ms
89
89
  * @public
90
- * @type Number
90
+ * @type {number}
91
91
  * @name minLife
92
92
  * @default 1000
93
93
  * @memberOf me.ParticleEmitterSettings
@@ -95,9 +95,9 @@ var ParticleEmitterSettings = {
95
95
  minLife : 1000,
96
96
 
97
97
  /**
98
- * Maximum time each particle lives once it is emitted in ms.<br>
98
+ * Maximum time each particle lives once it is emitted in ms
99
99
  * @public
100
- * @type Number
100
+ * @type {number}
101
101
  * @name maxLife
102
102
  * @default 3000
103
103
  * @memberOf me.ParticleEmitterSettings
@@ -107,7 +107,7 @@ var ParticleEmitterSettings = {
107
107
  /**
108
108
  * Start speed of particles.<br>
109
109
  * @public
110
- * @type Number
110
+ * @type {number}
111
111
  * @name speed
112
112
  * @default 2
113
113
  * @memberOf me.ParticleEmitterSettings
@@ -115,9 +115,9 @@ var ParticleEmitterSettings = {
115
115
  speed : 2,
116
116
 
117
117
  /**
118
- * Variation in the start speed of particles.<br>
118
+ * Variation in the start speed of particles
119
119
  * @public
120
- * @type Number
120
+ * @type {number}
121
121
  * @name speedVariation
122
122
  * @default 1
123
123
  * @memberOf me.ParticleEmitterSettings
@@ -125,9 +125,9 @@ var ParticleEmitterSettings = {
125
125
  speedVariation : 1,
126
126
 
127
127
  /**
128
- * Minimum start rotation for particles sprites in Radians.<br>
128
+ * Minimum start rotation for particles sprites in Radians
129
129
  * @public
130
- * @type Number
130
+ * @type {number}
131
131
  * @name minRotation
132
132
  * @default 0
133
133
  * @memberOf me.ParticleEmitterSettings
@@ -135,9 +135,9 @@ var ParticleEmitterSettings = {
135
135
  minRotation : 0,
136
136
 
137
137
  /**
138
- * Maximum start rotation for particles sprites in Radians.<br>
138
+ * Maximum start rotation for particles sprites in Radians
139
139
  * @public
140
- * @type Number
140
+ * @type {number}
141
141
  * @name maxRotation
142
142
  * @default 0
143
143
  * @memberOf me.ParticleEmitterSettings
@@ -145,9 +145,9 @@ var ParticleEmitterSettings = {
145
145
  maxRotation : 0,
146
146
 
147
147
  /**
148
- * Minimum start scale ratio for particles (1 = no scaling).<br>
148
+ * Minimum start scale ratio for particles (1 = no scaling)
149
149
  * @public
150
- * @type Number
150
+ * @type {number}
151
151
  * @name minStartScale
152
152
  * @default 1
153
153
  * @memberOf me.ParticleEmitterSettings
@@ -155,9 +155,9 @@ var ParticleEmitterSettings = {
155
155
  minStartScale : 1,
156
156
 
157
157
  /**
158
- * Maximum start scale ratio for particles (1 = no scaling).<br>
158
+ * Maximum start scale ratio for particles (1 = no scaling)
159
159
  * @public
160
- * @type Number
160
+ * @type {number}
161
161
  * @name maxStartScale
162
162
  * @default 1
163
163
  * @memberOf me.ParticleEmitterSettings
@@ -165,9 +165,9 @@ var ParticleEmitterSettings = {
165
165
  maxStartScale : 1,
166
166
 
167
167
  /**
168
- * Minimum end scale ratio for particles.<br>
168
+ * Minimum end scale ratio for particles
169
169
  * @public
170
- * @type Number
170
+ * @type {number}
171
171
  * @name minEndScale
172
172
  * @default 0
173
173
  * @memberOf me.ParticleEmitterSettings
@@ -175,9 +175,9 @@ var ParticleEmitterSettings = {
175
175
  minEndScale : 0,
176
176
 
177
177
  /**
178
- * Maximum end scale ratio for particles.<br>
178
+ * Maximum end scale ratio for particles
179
179
  * @public
180
- * @type Number
180
+ * @type {number}
181
181
  * @name maxEndScale
182
182
  * @default 0
183
183
  * @memberOf me.ParticleEmitterSettings
@@ -185,9 +185,9 @@ var ParticleEmitterSettings = {
185
185
  maxEndScale : 0,
186
186
 
187
187
  /**
188
- * Vertical force (Gravity) for each particle.<br>
188
+ * Vertical force (Gravity) for each particle
189
189
  * @public
190
- * @type Number
190
+ * @type {number}
191
191
  * @name gravity
192
192
  * @default 0
193
193
  * @memberOf me.ParticleEmitterSettings
@@ -196,9 +196,9 @@ var ParticleEmitterSettings = {
196
196
  gravity : 0,
197
197
 
198
198
  /**
199
- * Horizontal force (like a Wind) for each particle.<br>
199
+ * Horizontal force (like a Wind) for each particle
200
200
  * @public
201
- * @type Number
201
+ * @type {number}
202
202
  * @name wind
203
203
  * @default 0
204
204
  * @memberOf me.ParticleEmitterSettings
@@ -210,7 +210,7 @@ var ParticleEmitterSettings = {
210
210
  * The particle sprite should aim at zero angle (draw from left to right).<br>
211
211
  * Override the particle minRotation and maxRotation.<br>
212
212
  * @public
213
- * @type Boolean
213
+ * @type {boolean}
214
214
  * @name followTrajectory
215
215
  * @default false
216
216
  * @memberOf me.ParticleEmitterSettings
@@ -221,7 +221,7 @@ var ParticleEmitterSettings = {
221
221
  * Enable the Texture Additive by canvas composite operation (lighter).<br>
222
222
  * WARNING: Composite Operation may decreases performance!.<br>
223
223
  * @public
224
- * @type Boolean
224
+ * @type {boolean}
225
225
  * @name textureAdditive
226
226
  * @default false
227
227
  * @memberOf me.ParticleEmitterSettings
@@ -231,7 +231,7 @@ var ParticleEmitterSettings = {
231
231
  /**
232
232
  * Update particles only in the viewport, remove it when out of viewport.<br>
233
233
  * @public
234
- * @type Boolean
234
+ * @type {boolean}
235
235
  * @name onlyInViewport
236
236
  * @default true
237
237
  * @memberOf me.ParticleEmitterSettings
@@ -241,7 +241,7 @@ var ParticleEmitterSettings = {
241
241
  /**
242
242
  * Render particles in screen space. <br>
243
243
  * @public
244
- * @type Boolean
244
+ * @type {boolean}
245
245
  * @name floating
246
246
  * @default false
247
247
  * @memberOf me.ParticleEmitterSettings
@@ -251,7 +251,7 @@ var ParticleEmitterSettings = {
251
251
  /**
252
252
  * Maximum number of particles launched each time in this emitter (used only if emitter is Stream).<br>
253
253
  * @public
254
- * @type Number
254
+ * @type {number}
255
255
  * @name maxParticles
256
256
  * @default 10
257
257
  * @memberOf me.ParticleEmitterSettings
@@ -262,7 +262,7 @@ var ParticleEmitterSettings = {
262
262
  * How often a particle is emitted in ms (used only if emitter is Stream).<br>
263
263
  * Necessary that value is greater than zero.<br>
264
264
  * @public
265
- * @type Number
265
+ * @type {number}
266
266
  * @name frequency
267
267
  * @default 100
268
268
  * @memberOf me.ParticleEmitterSettings
@@ -273,7 +273,7 @@ var ParticleEmitterSettings = {
273
273
  * Duration that the emitter releases particles in ms (used only if emitter is Stream).<br>
274
274
  * After this period, the emitter stop the launch of particles.<br>
275
275
  * @public
276
- * @type Number
276
+ * @type {number}
277
277
  * @name duration
278
278
  * @default Infinity
279
279
  * @memberOf me.ParticleEmitterSettings
@@ -284,7 +284,7 @@ var ParticleEmitterSettings = {
284
284
  * Skip n frames after updating the particle system once. <br>
285
285
  * This can be used to reduce the performance impact of emitters with many particles.<br>
286
286
  * @public
287
- * @type Number
287
+ * @type {number}
288
288
  * @name framesToSkip
289
289
  * @default 0
290
290
  * @memberOf me.ParticleEmitterSettings
@@ -298,11 +298,10 @@ var ParticleEmitterSettings = {
298
298
  * @extends Rect
299
299
  * @memberOf me
300
300
  * @constructor
301
- * @param {Number} x x-position of the particle emitter
302
- * @param {Number} y y-position of the particle emitter
301
+ * @param {number} x x-position of the particle emitter
302
+ * @param {number} y y-position of the particle emitter
303
303
  * @param {object} settings An object containing the settings for the particle emitter. See {@link me.ParticleEmitterSettings}
304
304
  * @example
305
- *
306
305
  * // Create a basic emitter at position 100, 100
307
306
  * var emitter = new me.ParticleEmitter(100, 100);
308
307
  *
@@ -324,7 +323,6 @@ var ParticleEmitterSettings = {
324
323
  * // At the end, remove emitter from the game world
325
324
  * // call this in onDestroyEvent function
326
325
  * me.game.world.removeChild(emitter);
327
- *
328
326
  */
329
327
  class ParticleEmitter extends Renderable {
330
328
 
@@ -379,7 +377,7 @@ class ParticleEmitter extends Renderable {
379
377
 
380
378
  /**
381
379
  * Floating property for particles, value is forwarded to the particle container <br>
382
- * @type Boolean
380
+ * @type {boolean}
383
381
  * @name floating
384
382
  * @memberOf me.ParticleEmitter
385
383
  */
@@ -432,7 +430,7 @@ class ParticleEmitter extends Renderable {
432
430
  * @name getRandomPointX
433
431
  * @memberOf me.ParticleEmitter
434
432
  * @function
435
- * @return {Number}
433
+ * @returns {number}
436
434
  */
437
435
  getRandomPointX() {
438
436
  return this.pos.x + randomFloat(0, this.width);
@@ -443,7 +441,7 @@ class ParticleEmitter extends Renderable {
443
441
  * @name getRandomPointY
444
442
  * @memberOf me.ParticleEmitter
445
443
  * @function
446
- * @return {Number}
444
+ * @returns {number}
447
445
  */
448
446
  getRandomPointY() {
449
447
  return this.pos.y + randomFloat(0, this.height);
@@ -452,7 +450,7 @@ class ParticleEmitter extends Renderable {
452
450
  /**
453
451
  * Reset the emitter with default values.<br>
454
452
  * @function
455
- * @param {Object} settings [optional] object with emitter settings. See {@link me.ParticleEmitterSettings}
453
+ * @param {object} settings [optional] object with emitter settings. See {@link me.ParticleEmitterSettings}
456
454
  * @name reset
457
455
  * @memberOf me.ParticleEmitter
458
456
  */
@@ -484,7 +482,7 @@ class ParticleEmitter extends Renderable {
484
482
  /**
485
483
  * Emitter is of type stream and is launching particles <br>
486
484
  * @function
487
- * @returns {Boolean} Emitter is Stream and is launching particles
485
+ * @returns {boolean} Emitter is Stream and is launching particles
488
486
  * @name isRunning
489
487
  * @memberOf me.ParticleEmitter
490
488
  */
@@ -495,7 +493,7 @@ class ParticleEmitter extends Renderable {
495
493
  /**
496
494
  * Launch particles from emitter constantly <br>
497
495
  * Particles example: Fountains
498
- * @param {Number} duration [optional] time that the emitter releases particles in ms
496
+ * @param {number} duration [optional] time that the emitter releases particles in ms
499
497
  * @function
500
498
  * @name streamParticles
501
499
  * @memberOf me.ParticleEmitter
@@ -520,7 +518,7 @@ class ParticleEmitter extends Renderable {
520
518
  /**
521
519
  * Launch all particles from emitter and stop <br>
522
520
  * Particles example: Explosions <br>
523
- * @param {Number} total [optional] number of particles to launch
521
+ * @param {number} total [optional] number of particles to launch
524
522
  * @function
525
523
  * @name burstParticles
526
524
  * @memberOf me.ParticleEmitter
@@ -101,7 +101,7 @@ class Particle extends Renderable {
101
101
  * @memberOf me.Particle
102
102
  * @function
103
103
  * @ignore
104
- * @param {Number} dt time since the last update in milliseconds
104
+ * @param {number} dt time since the last update in milliseconds
105
105
  */
106
106
  update(dt) {
107
107
  // move things forward independent of the current frame rate
@@ -16,7 +16,7 @@ import { world } from "./../game.js";
16
16
  * @memberOf me
17
17
  * @constructor
18
18
  * @param {me.Renderable} ancestor the parent object this body is attached to
19
- * @param {me.Rect|me.Rect[]|me.Polygon|me.Polygon[]|me.Line|me.Line[]|me.Ellipse|me.Ellipse[]|me.Bounds|me.Bounds[]|Object} [shapes] a initial shape, list of shapes, or JSON object defining the body
19
+ * @param {me.Rect|me.Rect[]|me.Polygon|me.Polygon[]|me.Line|me.Line[]|me.Ellipse|me.Ellipse[]|me.Bounds|me.Bounds[]|object} [shapes] a initial shape, list of shapes, or JSON object defining the body
20
20
  * @param {Function} [onBodyUpdate] callback for when the body is updated (e.g. add/remove shapes)
21
21
  */
22
22
  class Body {
@@ -27,7 +27,7 @@ class Body {
27
27
  * a reference to the parent object that contains this body,
28
28
  * or undefined if it has not been added to one.
29
29
  * @public
30
- * @type me.Renderable
30
+ * @type {me.Renderable}
31
31
  * @default undefined
32
32
  * @name me.Body#ancestor
33
33
  */
@@ -59,7 +59,7 @@ class Body {
59
59
  * The body collision mask, that defines what should collide with what.<br>
60
60
  * (by default will collide with all entities)
61
61
  * @ignore
62
- * @type Number
62
+ * @type {number}
63
63
  * @default me.collision.types.ALL_OBJECT
64
64
  * @name collisionMask
65
65
  * @see me.collision.types
@@ -70,7 +70,7 @@ class Body {
70
70
  /**
71
71
  * define the collision type of the body for collision filtering
72
72
  * @public
73
- * @type Number
73
+ * @type {number}
74
74
  * @default me.collision.types.ENEMY_OBJECT
75
75
  * @name collisionType
76
76
  * @see me.collision.types
@@ -84,7 +84,7 @@ class Body {
84
84
  /**
85
85
  * body velocity
86
86
  * @public
87
- * @type me.Vector2d
87
+ * @type {me.Vector2d}
88
88
  * @default <0,0>
89
89
  * @name vel
90
90
  * @memberOf me.Body
@@ -98,7 +98,7 @@ class Body {
98
98
  * body force or acceleration (automatically) applied to the body.
99
99
  * when defining a force, user should also define a max velocity
100
100
  * @public
101
- * @type me.Vector2d
101
+ * @type {me.Vector2d}
102
102
  * @default <0,0>
103
103
  * @name force
104
104
  * @see me.Body.setMaxVelocity
@@ -129,7 +129,7 @@ class Body {
129
129
  /**
130
130
  * body friction
131
131
  * @public
132
- * @type me.Vector2d
132
+ * @type {me.Vector2d}
133
133
  * @default <0,0>
134
134
  * @name friction
135
135
  * @memberOf me.Body
@@ -143,7 +143,7 @@ class Body {
143
143
  * the body bouciness level when colliding with other solid bodies :
144
144
  * a value of 0 will not bounce, a value of 1 will fully rebound.
145
145
  * @public
146
- * @type {Number}
146
+ * @type {number}
147
147
  * @default 0
148
148
  * @name bounce
149
149
  * @memberOf me.Body
@@ -153,7 +153,7 @@ class Body {
153
153
  /**
154
154
  * the body mass
155
155
  * @public
156
- * @type {Number}
156
+ * @type {number}
157
157
  * @default 1
158
158
  * @name mass
159
159
  * @memberOf me.Body
@@ -163,7 +163,7 @@ class Body {
163
163
  /**
164
164
  * max velocity (to limit body velocity)
165
165
  * @public
166
- * @type me.Vector2d
166
+ * @type {me.Vector2d}
167
167
  * @default <490,490>
168
168
  * @name maxVel
169
169
  * @memberOf me.Body
@@ -179,7 +179,7 @@ class Body {
179
179
  * either this body is a static body or not
180
180
  * @readonly
181
181
  * @public
182
- * @type Boolean
182
+ * @type {boolean}
183
183
  * @default false
184
184
  * @name isStatic
185
185
  * @memberOf me.Body
@@ -191,7 +191,7 @@ class Body {
191
191
  * The degree to which this body is affected by the world gravity
192
192
  * @public
193
193
  * @see me.World.gravity
194
- * @type Number
194
+ * @type {number}
195
195
  * @default 1.0
196
196
  * @name gravityScale
197
197
  * @memberOf me.Body
@@ -202,7 +202,7 @@ class Body {
202
202
  * If true this body won't be affected by the world gravity
203
203
  * @public
204
204
  * @see me.World.gravity
205
- * @type Boolean
205
+ * @type {boolean}
206
206
  * @default false
207
207
  * @name ignoreGravity
208
208
  * @memberOf me.Body
@@ -215,7 +215,7 @@ class Body {
215
215
  * false if the object is standing on something<br>
216
216
  * @readonly
217
217
  * @public
218
- * @type Boolean
218
+ * @type {boolean}
219
219
  * @default false
220
220
  * @name falling
221
221
  * @memberOf me.Body
@@ -227,7 +227,7 @@ class Body {
227
227
  * equal true if the body is jumping<br>
228
228
  * @readonly
229
229
  * @public
230
- * @type Boolean
230
+ * @type {boolean}
231
231
  * @default false
232
232
  * @name jumping
233
233
  * @memberOf me.Body
@@ -263,7 +263,7 @@ class Body {
263
263
  * @memberOf me.Body
264
264
  * @public
265
265
  * @function
266
- * @param {Boolean} [isStatic=true]
266
+ * @param {boolean} [isStatic=true]
267
267
  */
268
268
  setStatic(isStatic = true) {
269
269
  this.isStatic = isStatic === true;
@@ -276,8 +276,8 @@ class Body {
276
276
  * @memberOf me.Body
277
277
  * @public
278
278
  * @function
279
- * @param {me.Rect|me.Polygon|me.Line|me.Ellipse|me.Bounds|Object} shape a shape or JSON object
280
- * @return {Number} the shape array length
279
+ * @param {me.Rect|me.Polygon|me.Line|me.Ellipse|me.Bounds|object} shape a shape or JSON object
280
+ * @returns {number} the shape array length
281
281
  * @example
282
282
  * // add a rectangle shape
283
283
  * this.body.addShape(new me.Rect(0, 0, image.width, image.height));
@@ -331,7 +331,7 @@ class Body {
331
331
  * @public
332
332
  * @function
333
333
  * @param {me.Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
334
- * @param {Number} [index=0] the shape object for which to set the vertices
334
+ * @param {number} [index=0] the shape object for which to set the vertices
335
335
  * @param {boolean} [clear=true] either to reset the body definition before adding the new vertices
336
336
  */
337
337
  setVertices(vertices, index = 0, clear = true) {
@@ -358,7 +358,7 @@ class Body {
358
358
  * @public
359
359
  * @function
360
360
  * @param {me.Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
361
- * @param {Number} [index=0] the shape object for which to set the vertices
361
+ * @param {number} [index=0] the shape object for which to set the vertices
362
362
  */
363
363
  addVertices(vertices, index = 0) {
364
364
  this.setVertices(vertices, index, false);
@@ -371,10 +371,10 @@ class Body {
371
371
  * @memberOf me.Body
372
372
  * @public
373
373
  * @function
374
- * @param {Object} json a JSON object as exported from a Physics Editor tool
375
- * @param {String} [id] an optional shape identifier within the given the json object
374
+ * @param {object} json a JSON object as exported from a Physics Editor tool
375
+ * @param {string} [id] an optional shape identifier within the given the json object
376
376
  * @see https://www.codeandweb.com/physicseditor
377
- * @return {Number} how many shapes were added to the body
377
+ * @returns {number} how many shapes were added to the body
378
378
  * @example
379
379
  * // define the body based on the banana shape
380
380
  * this.body.fromJSON(me.loader.getJSON("shapesdef").banana);
@@ -415,8 +415,8 @@ class Body {
415
415
  * @memberOf me.Body
416
416
  * @public
417
417
  * @function
418
- * @param {Number} [index=0] the shape object at the specified index
419
- * @return {me.Polygon|me.Line|me.Ellipse} shape a shape object if defined
418
+ * @param {number} [index=0] the shape object at the specified index
419
+ * @returns {me.Polygon|me.Line|me.Ellipse} shape a shape object if defined
420
420
  */
421
421
  getShape(index) {
422
422
  return this.shapes[index || 0];
@@ -427,7 +427,7 @@ class Body {
427
427
  * @name getBounds
428
428
  * @memberOf me.Body
429
429
  * @function
430
- * @return {me.Bounds} bounding box Rectangle object
430
+ * @returns {me.Bounds} bounding box Rectangle object
431
431
  */
432
432
  getBounds() {
433
433
  return this.bounds;
@@ -440,7 +440,7 @@ class Body {
440
440
  * @public
441
441
  * @function
442
442
  * @param {me.Polygon|me.Line|me.Ellipse} shape a shape object
443
- * @return {Number} the shape array length
443
+ * @returns {number} the shape array length
444
444
  */
445
445
  removeShape(shape) {
446
446
  // clear the current bounds
@@ -461,8 +461,8 @@ class Body {
461
461
  * @memberOf me.Body
462
462
  * @public
463
463
  * @function
464
- * @param {Number} index the shape object at the specified index
465
- * @return {Number} the shape array length
464
+ * @param {number} index the shape object at the specified index
465
+ * @returns {number} the shape array length
466
466
  */
467
467
  removeShapeAt(index) {
468
468
  return this.removeShape(this.getShape(index));
@@ -477,7 +477,7 @@ class Body {
477
477
  * @public
478
478
  * @function
479
479
  * @see me.collision.types
480
- * @param {Number} [bitmask = me.collision.types.ALL_OBJECT] the collision mask
480
+ * @param {number} [bitmask = me.collision.types.ALL_OBJECT] the collision mask
481
481
  * @example
482
482
  * // filter collision detection with collision shapes, enemies and collectables
483
483
  * myEntity.body.setCollisionMask(me.collision.types.WORLD_SHAPE | me.collision.types.ENEMY_OBJECT | me.collision.types.COLLECTABLE_OBJECT);
@@ -496,7 +496,7 @@ class Body {
496
496
  * @public
497
497
  * @function
498
498
  * @see me.collision.types
499
- * @param {Number} type the collision type
499
+ * @param {number} type the collision type
500
500
  * @example
501
501
  * // set the body collision type
502
502
  * myEntity.body.collisionType = me.collision.types.PLAYER_OBJECT;
@@ -558,7 +558,7 @@ class Body {
558
558
  * @memberOf me.Body.prototype
559
559
  * @function
560
560
  * @param {Function} callback fnction to execute on each element
561
- * @param {Object} [thisArg] value to use as this(i.e reference Object) when executing callback.
561
+ * @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
562
562
  * @example
563
563
  * // iterate through all shapes of the physic body
564
564
  * mySprite.body.forEach((shape) => {
@@ -595,7 +595,7 @@ class Body {
595
595
  * @memberOf me.Body
596
596
  * @function
597
597
  * @param {me.Vector2d} point
598
- * @return {boolean} true if contains
598
+ * @returns {boolean} true if contains
599
599
  */
600
600
 
601
601
  /**
@@ -603,9 +603,9 @@ class Body {
603
603
  * @name contains
604
604
  * @memberOf me.Body
605
605
  * @function
606
- * @param {Number} x x coordinate
607
- * @param {Number} y y coordinate
608
- * @return {boolean} true if contains
606
+ * @param {number} x x coordinate
607
+ * @param {number} y y coordinate
608
+ * @returns {boolean} true if contains
609
609
  */
610
610
  contains() {
611
611
  var _x, _y;
@@ -637,9 +637,9 @@ class Body {
637
637
  * @name rotate
638
638
  * @memberOf me.Body
639
639
  * @function
640
- * @param {Number} angle The angle to rotate (in radians)
640
+ * @param {number} angle The angle to rotate (in radians)
641
641
  * @param {me.Vector2d|me.ObservableVector2d} [v=me.Body.getBounds().center] an optional point to rotate around
642
- * @return {me.Body} Reference to this object for method chaining
642
+ * @returns {me.Body} Reference to this object for method chaining
643
643
  */
644
644
  rotate(angle, v = this.getBounds().center) {
645
645
  this.bounds.clear();
@@ -664,8 +664,8 @@ class Body {
664
664
  * @name setMaxVelocity
665
665
  * @memberOf me.Body
666
666
  * @function
667
- * @param {Number} x max velocity on x axis
668
- * @param {Number} y max velocity on y axis
667
+ * @param {number} x max velocity on x axis
668
+ * @param {number} y max velocity on y axis
669
669
  * @protected
670
670
  */
671
671
  setMaxVelocity(x, y) {
@@ -678,8 +678,8 @@ class Body {
678
678
  * @name setFriction
679
679
  * @memberOf me.Body
680
680
  * @function
681
- * @param {Number} x horizontal friction
682
- * @param {Number} y vertical friction
681
+ * @param {number} x horizontal friction
682
+ * @param {number} y vertical friction
683
683
  * @protected
684
684
  */
685
685
  setFriction(x = 0, y = 0) {
@@ -765,8 +765,8 @@ class Body {
765
765
  * @ignore
766
766
  * @memberOf me.Body
767
767
  * @function
768
- * @return {boolean} true if resulting velocity is different than 0
769
- * @see source code for me.Body.computeVelocity (private member)
768
+ * @param {number} dt time since the last update in milliseconds.
769
+ * @returns {boolean} true if resulting velocity is different than 0
770
770
  */
771
771
  update(dt) {
772
772
  // update the velocity