melonjs 10.3.0 → 10.5.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.
- package/README.md +6 -6
- package/dist/melonjs.js +3147 -3293
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +3411 -3852
- package/dist/melonjs.module.js +3448 -3210
- package/package.json +18 -17
- package/src/audio/audio.js +29 -30
- package/src/camera/camera2d.js +46 -56
- package/src/entity/entity.js +30 -36
- package/src/game.js +21 -22
- package/src/geometries/ellipse.js +40 -46
- package/src/geometries/line.js +9 -11
- package/src/geometries/poly.js +53 -53
- package/src/geometries/rectangle.js +42 -44
- package/src/index.js +9 -26
- package/src/input/gamepad.js +11 -10
- package/src/input/input.js +2 -3
- package/src/input/keyboard.js +113 -113
- package/src/input/pointer.js +30 -31
- package/src/input/pointerevent.js +26 -26
- package/src/lang/deprecated.js +65 -6
- package/src/level/level.js +23 -24
- package/src/level/tiled/TMXGroup.js +7 -8
- package/src/level/tiled/TMXLayer.js +30 -32
- package/src/level/tiled/TMXObject.js +21 -21
- package/src/level/tiled/TMXTile.js +18 -18
- package/src/level/tiled/TMXTileMap.js +39 -44
- package/src/level/tiled/TMXTileset.js +12 -15
- package/src/level/tiled/TMXTilesetGroup.js +9 -9
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +7 -8
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +7 -8
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +4 -5
- package/src/level/tiled/renderer/TMXRenderer.js +24 -25
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -4
- package/src/loader/loader.js +14 -15
- package/src/loader/loadingscreen.js +2 -4
- package/src/math/color.js +47 -66
- package/src/math/math.js +15 -16
- package/src/math/matrix2.js +53 -58
- package/src/math/matrix3.js +56 -62
- package/src/math/observable_vector2.js +75 -76
- package/src/math/observable_vector3.js +79 -80
- package/src/math/vector2.js +91 -92
- package/src/math/vector3.js +94 -96
- package/src/particles/emitter.js +38 -40
- package/src/particles/particle.js +4 -5
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +46 -143
- package/src/physics/bounds.js +47 -47
- package/src/physics/collision.js +13 -14
- package/src/physics/detector.js +18 -17
- package/src/physics/quadtree.js +17 -19
- package/src/physics/sat.js +26 -26
- package/src/physics/world.js +24 -28
- package/src/plugin/plugin.js +11 -14
- package/src/renderable/GUI.js +41 -46
- package/src/renderable/collectable.js +4 -8
- package/src/renderable/colorlayer.js +6 -10
- package/src/renderable/container.js +87 -72
- package/src/renderable/dragndrop.js +224 -0
- package/src/renderable/imagelayer.js +25 -31
- package/src/renderable/nineslicesprite.js +41 -41
- package/src/renderable/renderable.js +114 -125
- package/src/renderable/sprite.js +62 -68
- package/src/renderable/trigger.js +25 -30
- package/src/state/stage.js +13 -17
- package/src/state/state.js +26 -27
- package/src/system/device.js +74 -75
- package/src/system/event.js +71 -72
- package/src/system/pooling.js +11 -12
- package/src/system/save.js +3 -4
- package/src/system/timer.js +19 -20
- package/src/text/bitmaptext.js +57 -54
- package/src/text/bitmaptextdata.js +10 -10
- package/src/text/glyph.js +3 -0
- package/src/text/text.js +44 -49
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +1 -1
- package/src/tweens/tween.js +43 -44
- package/src/utils/agent.js +3 -4
- package/src/utils/array.js +4 -5
- package/src/utils/file.js +3 -4
- package/src/utils/function.js +4 -5
- package/src/utils/string.js +7 -9
- package/src/utils/utils.js +4 -5
- package/src/video/canvas/canvas_renderer.js +58 -59
- package/src/video/renderer.js +49 -53
- package/src/video/texture.js +98 -111
- package/src/video/texture_cache.js +24 -6
- package/src/video/video.js +16 -17
- package/src/video/webgl/glshader.js +37 -38
- package/src/video/webgl/webgl_compositor.js +31 -32
- package/src/video/webgl/webgl_renderer.js +79 -80
- package/src/entity/draggable.js +0 -130
- package/src/entity/droptarget.js +0 -101
package/src/physics/body.js
CHANGED
|
@@ -11,46 +11,41 @@ import { world } from "./../game.js";
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
+
* @classdesc
|
|
14
15
|
* a Generic Physic Body Object with some physic properties and behavior functionality, to as a member of a Renderable.
|
|
15
|
-
* @class Body
|
|
16
|
-
* @memberof me
|
|
17
|
-
* @param {me.Renderable} ancestor the parent object this body is attached to
|
|
18
|
-
* @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 {Function} [onBodyUpdate] callback for when the body is updated (e.g. add/remove shapes)
|
|
20
16
|
*/
|
|
21
17
|
class Body {
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param {Renderable} ancestor the parent object this body is attached to
|
|
20
|
+
* @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Bounds|Bounds[]|object} [shapes] a initial shape, list of shapes, or JSON object defining the body
|
|
21
|
+
* @param {Function} [onBodyUpdate] callback for when the body is updated (e.g. add/remove shapes)
|
|
22
|
+
*/
|
|
23
|
+
constructor(ancestor, shapes, onBodyUpdate) {
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* a reference to the parent object that contains this body,
|
|
27
27
|
* or undefined if it has not been added to one.
|
|
28
28
|
* @public
|
|
29
|
-
* @type {
|
|
29
|
+
* @type {Renderable}
|
|
30
30
|
* @default undefined
|
|
31
|
-
* @name me.Body#ancestor
|
|
32
31
|
*/
|
|
33
|
-
this.ancestor =
|
|
32
|
+
this.ancestor = ancestor;
|
|
34
33
|
|
|
35
|
-
/**
|
|
36
|
-
* The AABB bounds box reprensenting this body
|
|
37
|
-
* @public
|
|
38
|
-
* @type {me.Bounds}
|
|
39
|
-
* @name bounds
|
|
40
|
-
* @memberof me.Body
|
|
41
|
-
*/
|
|
42
34
|
if (typeof this.bounds === "undefined") {
|
|
35
|
+
/**
|
|
36
|
+
* The AABB bounds box reprensenting this body
|
|
37
|
+
* @public
|
|
38
|
+
* @type {Bounds}
|
|
39
|
+
*/
|
|
43
40
|
this.bounds = new Bounds();
|
|
44
41
|
}
|
|
45
42
|
|
|
46
|
-
/**
|
|
47
|
-
* The collision shapes of the body
|
|
48
|
-
* @ignore
|
|
49
|
-
* @type {me.Polygon[]|me.Line[]|me.Ellipse[]}
|
|
50
|
-
* @name shapes
|
|
51
|
-
* @memberof me.Body
|
|
52
|
-
*/
|
|
53
43
|
if (typeof this.shapes === "undefined") {
|
|
44
|
+
/**
|
|
45
|
+
* The collision shapes of the body
|
|
46
|
+
* @ignore
|
|
47
|
+
* @type {Polygon[]|Line[]|Ellipse[]}
|
|
48
|
+
*/
|
|
54
49
|
this.shapes = [];
|
|
55
50
|
}
|
|
56
51
|
|
|
@@ -59,10 +54,8 @@ class Body {
|
|
|
59
54
|
* (by default will collide with all entities)
|
|
60
55
|
* @ignore
|
|
61
56
|
* @type {number}
|
|
62
|
-
* @default
|
|
63
|
-
* @
|
|
64
|
-
* @see me.collision.types
|
|
65
|
-
* @memberof me.Body
|
|
57
|
+
* @default collision.types.ALL_OBJECT
|
|
58
|
+
* @see collision.types
|
|
66
59
|
*/
|
|
67
60
|
this.collisionMask = collision.types.ALL_OBJECT;
|
|
68
61
|
|
|
@@ -70,10 +63,8 @@ class Body {
|
|
|
70
63
|
* define the collision type of the body for collision filtering
|
|
71
64
|
* @public
|
|
72
65
|
* @type {number}
|
|
73
|
-
* @default
|
|
74
|
-
* @
|
|
75
|
-
* @see me.collision.types
|
|
76
|
-
* @memberof me.Body
|
|
66
|
+
* @default collision.types.ENEMY_OBJECT
|
|
67
|
+
* @see collision.types
|
|
77
68
|
* @example
|
|
78
69
|
* // set the body collision type
|
|
79
70
|
* myEntity.body.collisionType = me.collision.types.PLAYER_OBJECT;
|
|
@@ -83,10 +74,8 @@ class Body {
|
|
|
83
74
|
/**
|
|
84
75
|
* body velocity
|
|
85
76
|
* @public
|
|
86
|
-
* @type {
|
|
77
|
+
* @type {Vector2d}
|
|
87
78
|
* @default <0,0>
|
|
88
|
-
* @name vel
|
|
89
|
-
* @memberof me.Body
|
|
90
79
|
*/
|
|
91
80
|
if (typeof this.vel === "undefined") {
|
|
92
81
|
this.vel = new Vector2d();
|
|
@@ -97,11 +86,9 @@ class Body {
|
|
|
97
86
|
* body force or acceleration (automatically) applied to the body.
|
|
98
87
|
* when defining a force, user should also define a max velocity
|
|
99
88
|
* @public
|
|
100
|
-
* @type {
|
|
89
|
+
* @type {Vector2d}
|
|
101
90
|
* @default <0,0>
|
|
102
|
-
* @
|
|
103
|
-
* @see me.Body.setMaxVelocity
|
|
104
|
-
* @memberof me.Body
|
|
91
|
+
* @see Body.setMaxVelocity
|
|
105
92
|
* @example
|
|
106
93
|
* // define a default maximum acceleration, initial force and friction
|
|
107
94
|
* this.body.force.set(0, 0);
|
|
@@ -128,10 +115,8 @@ class Body {
|
|
|
128
115
|
/**
|
|
129
116
|
* body friction
|
|
130
117
|
* @public
|
|
131
|
-
* @type {
|
|
118
|
+
* @type {Vector2d}
|
|
132
119
|
* @default <0,0>
|
|
133
|
-
* @name friction
|
|
134
|
-
* @memberof me.Body
|
|
135
120
|
*/
|
|
136
121
|
if (typeof this.friction === "undefined") {
|
|
137
122
|
this.friction = new Vector2d();
|
|
@@ -144,8 +129,6 @@ class Body {
|
|
|
144
129
|
* @public
|
|
145
130
|
* @type {number}
|
|
146
131
|
* @default 0
|
|
147
|
-
* @name bounce
|
|
148
|
-
* @memberof me.Body
|
|
149
132
|
*/
|
|
150
133
|
this.bounce = 0;
|
|
151
134
|
|
|
@@ -154,18 +137,14 @@ class Body {
|
|
|
154
137
|
* @public
|
|
155
138
|
* @type {number}
|
|
156
139
|
* @default 1
|
|
157
|
-
* @name mass
|
|
158
|
-
* @memberof me.Body
|
|
159
140
|
*/
|
|
160
141
|
this.mass = 1;
|
|
161
142
|
|
|
162
143
|
/**
|
|
163
144
|
* max velocity (to limit body velocity)
|
|
164
145
|
* @public
|
|
165
|
-
* @type {
|
|
146
|
+
* @type {Vector2d}
|
|
166
147
|
* @default <490,490>
|
|
167
|
-
* @name maxVel
|
|
168
|
-
* @memberof me.Body
|
|
169
148
|
*/
|
|
170
149
|
if (typeof this.maxVel === "undefined") {
|
|
171
150
|
this.maxVel = new Vector2d();
|
|
@@ -175,13 +154,12 @@ class Body {
|
|
|
175
154
|
|
|
176
155
|
|
|
177
156
|
/**
|
|
178
|
-
*
|
|
157
|
+
* Either this body is a static body or not.
|
|
158
|
+
* A static body is completely fixed and can never change position or angle.
|
|
179
159
|
* @readonly
|
|
180
160
|
* @public
|
|
181
161
|
* @type {boolean}
|
|
182
162
|
* @default false
|
|
183
|
-
* @name isStatic
|
|
184
|
-
* @memberof me.Body
|
|
185
163
|
*/
|
|
186
164
|
this.isStatic = false;
|
|
187
165
|
|
|
@@ -189,22 +167,18 @@ class Body {
|
|
|
189
167
|
/**
|
|
190
168
|
* The degree to which this body is affected by the world gravity
|
|
191
169
|
* @public
|
|
192
|
-
* @see
|
|
170
|
+
* @see World.gravity
|
|
193
171
|
* @type {number}
|
|
194
172
|
* @default 1.0
|
|
195
|
-
* @name gravityScale
|
|
196
|
-
* @memberof me.Body
|
|
197
173
|
*/
|
|
198
174
|
this.gravityScale = 1.0;
|
|
199
175
|
|
|
200
176
|
/**
|
|
201
177
|
* If true this body won't be affected by the world gravity
|
|
202
178
|
* @public
|
|
203
|
-
* @see
|
|
179
|
+
* @see World.gravity
|
|
204
180
|
* @type {boolean}
|
|
205
181
|
* @default false
|
|
206
|
-
* @name ignoreGravity
|
|
207
|
-
* @memberof me.Body
|
|
208
182
|
*/
|
|
209
183
|
this.ignoreGravity = false;
|
|
210
184
|
|
|
@@ -216,8 +190,6 @@ class Body {
|
|
|
216
190
|
* @public
|
|
217
191
|
* @type {boolean}
|
|
218
192
|
* @default false
|
|
219
|
-
* @name falling
|
|
220
|
-
* @memberof me.Body
|
|
221
193
|
*/
|
|
222
194
|
this.falling = false;
|
|
223
195
|
|
|
@@ -228,8 +200,6 @@ class Body {
|
|
|
228
200
|
* @public
|
|
229
201
|
* @type {boolean}
|
|
230
202
|
* @default false
|
|
231
|
-
* @name jumping
|
|
232
|
-
* @memberof me.Body
|
|
233
203
|
*/
|
|
234
204
|
this.jumping = false;
|
|
235
205
|
|
|
@@ -258,10 +228,6 @@ class Body {
|
|
|
258
228
|
/**
|
|
259
229
|
* set the body as a static body
|
|
260
230
|
* static body do not move automatically and do not check againt collision with others
|
|
261
|
-
* @name setStatic
|
|
262
|
-
* @memberof me.Body
|
|
263
|
-
* @public
|
|
264
|
-
* @function
|
|
265
231
|
* @param {boolean} [isStatic=true]
|
|
266
232
|
*/
|
|
267
233
|
setStatic(isStatic = true) {
|
|
@@ -271,11 +237,7 @@ class Body {
|
|
|
271
237
|
/**
|
|
272
238
|
* add a collision shape to this body <br>
|
|
273
239
|
* (note: me.Rect objects will be converted to me.Polygon before being added)
|
|
274
|
-
* @
|
|
275
|
-
* @memberof me.Body
|
|
276
|
-
* @public
|
|
277
|
-
* @function
|
|
278
|
-
* @param {me.Rect|me.Polygon|me.Line|me.Ellipse|me.Bounds|object} shape a shape or JSON object
|
|
240
|
+
* @param {Rect|Polygon|Line|Ellipse|Bounds|object} shape a shape or JSON object
|
|
279
241
|
* @returns {number} the shape array length
|
|
280
242
|
* @example
|
|
281
243
|
* // add a rectangle shape
|
|
@@ -325,11 +287,7 @@ class Body {
|
|
|
325
287
|
|
|
326
288
|
/**
|
|
327
289
|
* set the body vertices to the given one
|
|
328
|
-
* @
|
|
329
|
-
* @memberof me.Body
|
|
330
|
-
* @public
|
|
331
|
-
* @function
|
|
332
|
-
* @param {me.Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
|
|
290
|
+
* @param {Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
|
|
333
291
|
* @param {number} [index=0] the shape object for which to set the vertices
|
|
334
292
|
* @param {boolean} [clear=true] either to reset the body definition before adding the new vertices
|
|
335
293
|
*/
|
|
@@ -352,11 +310,7 @@ class Body {
|
|
|
352
310
|
|
|
353
311
|
/**
|
|
354
312
|
* add the given vertices to the body shape
|
|
355
|
-
* @
|
|
356
|
-
* @memberof me.Body
|
|
357
|
-
* @public
|
|
358
|
-
* @function
|
|
359
|
-
* @param {me.Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
|
|
313
|
+
* @param {Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
|
|
360
314
|
* @param {number} [index=0] the shape object for which to set the vertices
|
|
361
315
|
*/
|
|
362
316
|
addVertices(vertices, index = 0) {
|
|
@@ -366,10 +320,6 @@ class Body {
|
|
|
366
320
|
/**
|
|
367
321
|
* add collision mesh based on a JSON object
|
|
368
322
|
* (this will also apply any physic properties defined in the given JSON file)
|
|
369
|
-
* @name fromJSON
|
|
370
|
-
* @memberof me.Body
|
|
371
|
-
* @public
|
|
372
|
-
* @function
|
|
373
323
|
* @param {object} json a JSON object as exported from a Physics Editor tool
|
|
374
324
|
* @param {string} [id] an optional shape identifier within the given the json object
|
|
375
325
|
* @see https://www.codeandweb.com/physicseditor
|
|
@@ -410,12 +360,8 @@ class Body {
|
|
|
410
360
|
|
|
411
361
|
/**
|
|
412
362
|
* return the collision shape at the given index
|
|
413
|
-
* @name getShape
|
|
414
|
-
* @memberof me.Body
|
|
415
|
-
* @public
|
|
416
|
-
* @function
|
|
417
363
|
* @param {number} [index=0] the shape object at the specified index
|
|
418
|
-
* @returns {
|
|
364
|
+
* @returns {Polygon|Line|Ellipse} shape a shape object if defined
|
|
419
365
|
*/
|
|
420
366
|
getShape(index) {
|
|
421
367
|
return this.shapes[index || 0];
|
|
@@ -423,10 +369,8 @@ class Body {
|
|
|
423
369
|
|
|
424
370
|
/**
|
|
425
371
|
* returns the AABB bounding box for this body
|
|
426
|
-
* @name getBounds
|
|
427
|
-
* @memberof me.Body
|
|
428
372
|
* @function
|
|
429
|
-
* @returns {
|
|
373
|
+
* @returns {Bounds} bounding box Rectangle object
|
|
430
374
|
*/
|
|
431
375
|
getBounds() {
|
|
432
376
|
return this.bounds;
|
|
@@ -434,11 +378,7 @@ class Body {
|
|
|
434
378
|
|
|
435
379
|
/**
|
|
436
380
|
* remove the specified shape from the body shape list
|
|
437
|
-
* @
|
|
438
|
-
* @memberof me.Body
|
|
439
|
-
* @public
|
|
440
|
-
* @function
|
|
441
|
-
* @param {me.Polygon|me.Line|me.Ellipse} shape a shape object
|
|
381
|
+
* @param {Polygon|Line|Ellipse} shape a shape object
|
|
442
382
|
* @returns {number} the shape array length
|
|
443
383
|
*/
|
|
444
384
|
removeShape(shape) {
|
|
@@ -456,10 +396,6 @@ class Body {
|
|
|
456
396
|
|
|
457
397
|
/**
|
|
458
398
|
* remove the shape at the given index from the body shape list
|
|
459
|
-
* @name removeShapeAt
|
|
460
|
-
* @memberof me.Body
|
|
461
|
-
* @public
|
|
462
|
-
* @function
|
|
463
399
|
* @param {number} index the shape object at the specified index
|
|
464
400
|
* @returns {number} the shape array length
|
|
465
401
|
*/
|
|
@@ -471,12 +407,8 @@ class Body {
|
|
|
471
407
|
* By default all entities are able to collide with all other entities, <br>
|
|
472
408
|
* but it's also possible to specify 'collision filters' to provide a finer <br>
|
|
473
409
|
* control over which entities can collide with each other.
|
|
474
|
-
* @
|
|
475
|
-
* @
|
|
476
|
-
* @public
|
|
477
|
-
* @function
|
|
478
|
-
* @see me.collision.types
|
|
479
|
-
* @param {number} [bitmask = me.collision.types.ALL_OBJECT] the collision mask
|
|
410
|
+
* @see collision.types
|
|
411
|
+
* @param {number} [bitmask = collision.types.ALL_OBJECT] the collision mask
|
|
480
412
|
* @example
|
|
481
413
|
* // filter collision detection with collision shapes, enemies and collectables
|
|
482
414
|
* myEntity.body.setCollisionMask(me.collision.types.WORLD_SHAPE | me.collision.types.ENEMY_OBJECT | me.collision.types.COLLECTABLE_OBJECT);
|
|
@@ -490,11 +422,7 @@ class Body {
|
|
|
490
422
|
|
|
491
423
|
/**
|
|
492
424
|
* define the collision type of the body for collision filtering
|
|
493
|
-
* @
|
|
494
|
-
* @memberof me.Body
|
|
495
|
-
* @public
|
|
496
|
-
* @function
|
|
497
|
-
* @see me.collision.types
|
|
425
|
+
* @see collision.types
|
|
498
426
|
* @param {number} type the collision type
|
|
499
427
|
* @example
|
|
500
428
|
* // set the body collision type
|
|
@@ -512,11 +440,7 @@ class Body {
|
|
|
512
440
|
|
|
513
441
|
/**
|
|
514
442
|
* the built-in function to solve the collision response
|
|
515
|
-
* @
|
|
516
|
-
* @name respondToCollision
|
|
517
|
-
* @memberof me.Body
|
|
518
|
-
* @function
|
|
519
|
-
* @param {me.collision.ResponseObject} response the collision response object
|
|
443
|
+
* @param {object} response the collision response object (see {@link collision.ResponseObject})
|
|
520
444
|
*/
|
|
521
445
|
respondToCollision(response) {
|
|
522
446
|
// the overlap vector
|
|
@@ -553,9 +477,6 @@ class Body {
|
|
|
553
477
|
* - The current element being processed in the array <br>
|
|
554
478
|
* - The index of element in the array. <br>
|
|
555
479
|
* - The array forEach() was called upon. <br>
|
|
556
|
-
* @name forEach
|
|
557
|
-
* @memberof me.Body.prototype
|
|
558
|
-
* @function
|
|
559
480
|
* @param {Function} callback fnction to execute on each element
|
|
560
481
|
* @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
|
|
561
482
|
* @example
|
|
@@ -590,18 +511,12 @@ class Body {
|
|
|
590
511
|
|
|
591
512
|
/**
|
|
592
513
|
* Returns true if the any of the shape composing the body contains the given point.
|
|
593
|
-
* @
|
|
594
|
-
* @memberof me.Body
|
|
595
|
-
* @function
|
|
596
|
-
* @param {me.Vector2d} point
|
|
514
|
+
* @param {Vector2d} point
|
|
597
515
|
* @returns {boolean} true if contains
|
|
598
516
|
*/
|
|
599
517
|
|
|
600
518
|
/**
|
|
601
519
|
* Returns true if the any of the shape composing the body contains the given point.
|
|
602
|
-
* @name contains
|
|
603
|
-
* @memberof me.Body
|
|
604
|
-
* @function
|
|
605
520
|
* @param {number} x x coordinate
|
|
606
521
|
* @param {number} y y coordinate
|
|
607
522
|
* @returns {boolean} true if contains
|
|
@@ -633,12 +548,9 @@ class Body {
|
|
|
633
548
|
/**
|
|
634
549
|
* Rotate this body (counter-clockwise) by the specified angle (in radians).
|
|
635
550
|
* Unless specified the body will be rotated around its center point
|
|
636
|
-
* @name rotate
|
|
637
|
-
* @memberof me.Body
|
|
638
|
-
* @function
|
|
639
551
|
* @param {number} angle The angle to rotate (in radians)
|
|
640
|
-
* @param {
|
|
641
|
-
* @returns {
|
|
552
|
+
* @param {Vector2d|ObservableVector2d} [v=Body.getBounds().center] an optional point to rotate around
|
|
553
|
+
* @returns {Body} Reference to this object for method chaining
|
|
642
554
|
*/
|
|
643
555
|
rotate(angle, v = this.getBounds().center) {
|
|
644
556
|
this.bounds.clear();
|
|
@@ -660,9 +572,6 @@ class Body {
|
|
|
660
572
|
|
|
661
573
|
/**
|
|
662
574
|
* cap the body velocity (body.maxVel property) to the specified value<br>
|
|
663
|
-
* @name setMaxVelocity
|
|
664
|
-
* @memberof me.Body
|
|
665
|
-
* @function
|
|
666
575
|
* @param {number} x max velocity on x axis
|
|
667
576
|
* @param {number} y max velocity on y axis
|
|
668
577
|
* @protected
|
|
@@ -674,9 +583,6 @@ class Body {
|
|
|
674
583
|
|
|
675
584
|
/**
|
|
676
585
|
* set the body default friction
|
|
677
|
-
* @name setFriction
|
|
678
|
-
* @memberof me.Body
|
|
679
|
-
* @function
|
|
680
586
|
* @param {number} x horizontal friction
|
|
681
587
|
* @param {number} y vertical friction
|
|
682
588
|
* @protected
|
|
@@ -760,10 +666,7 @@ class Body {
|
|
|
760
666
|
* property is set to true and Body.jumping is set to !Body.falling.
|
|
761
667
|
*
|
|
762
668
|
* At this time a call to Body.Update does not call the onBodyUpdate callback that is listed in the constructor arguments.
|
|
763
|
-
* @
|
|
764
|
-
* @ignore
|
|
765
|
-
* @memberof me.Body
|
|
766
|
-
* @function
|
|
669
|
+
* @protected
|
|
767
670
|
* @param {number} dt time since the last update in milliseconds.
|
|
768
671
|
* @returns {boolean} true if resulting velocity is different than 0
|
|
769
672
|
*/
|