Skip to content

Commit 8ffd686

Browse files
committed
Phaser 2.2.0-RC12 Release
1 parent 30d2d19 commit 8ffd686

13 files changed

Lines changed: 1586 additions & 618 deletions

build/custom/p2.js

Lines changed: 79 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14290,7 +14290,7 @@ Phaser.Physics.P2.prototype = {
1429014290
*/
1429114291
update: function () {
1429214292

14293-
// Do nothing when the pysics engine was paused before
14293+
// Do nothing if the physics engine was paused before
1429414294
if (this.paused)
1429514295
{
1429614296
return;
@@ -14307,14 +14307,84 @@ Phaser.Physics.P2.prototype = {
1430714307

1430814308
},
1430914309

14310+
/**
14311+
* Called by Phaser.Physics when a State swap occurs.
14312+
* Starts the begin and end Contact listeners again.
14313+
*
14314+
* @method Phaser.Physics.P2#reset
14315+
*/
14316+
reset: function () {
14317+
14318+
this.world.on("beginContact", this.beginContactHandler, this);
14319+
this.world.on("endContact", this.endContactHandler, this);
14320+
14321+
this.nothingCollisionGroup = new Phaser.Physics.P2.CollisionGroup(1);
14322+
this.boundsCollisionGroup = new Phaser.Physics.P2.CollisionGroup(2);
14323+
this.everythingCollisionGroup = new Phaser.Physics.P2.CollisionGroup(2147483648);
14324+
14325+
this._collisionGroupID = 2;
14326+
14327+
this.setBoundsToWorld(true, true, true, true, false);
14328+
14329+
},
14330+
1431014331
/**
1431114332
* Clears all bodies from the simulation, resets callbacks and resets the collision bitmask.
14333+
*
14334+
* The P2 world is also cleared:
14335+
*
14336+
* * Removes all solver equations
14337+
* * Removes all constraints
14338+
* * Removes all bodies
14339+
* * Removes all springs
14340+
* * Removes all contact materials
14341+
*
14342+
* This is called automatically when you switch state.
1431214343
*
1431314344
* @method Phaser.Physics.P2#clear
1431414345
*/
1431514346
clear: function () {
1431614347

14317-
this.world.clear();
14348+
this.world.time = 0;
14349+
this.world.fixedStepTime = 0;
14350+
14351+
// Remove all solver equations
14352+
if (this.world.solver && this.world.solver.equations.length)
14353+
{
14354+
this.world.solver.removeAllEquations();
14355+
}
14356+
14357+
// Remove all constraints
14358+
var cs = this.world.constraints;
14359+
14360+
for (var i = cs.length - 1; i >= 0; i--)
14361+
{
14362+
this.world.removeConstraint(cs[i]);
14363+
}
14364+
14365+
// Remove all bodies
14366+
var bodies = this.world.bodies;
14367+
14368+
for (var i = bodies.length - 1; i >= 0; i--)
14369+
{
14370+
this.world.removeBody(bodies[i]);
14371+
}
14372+
14373+
// Remove all springs
14374+
var springs = this.world.springs;
14375+
14376+
for (var i = springs.length - 1; i >= 0; i--)
14377+
{
14378+
this.world.removeSpring(springs[i]);
14379+
}
14380+
14381+
// Remove all contact materials
14382+
var cms = this.world.contactMaterials;
14383+
14384+
for (var i = cms.length - 1; i >= 0; i--)
14385+
{
14386+
this.world.removeContactMaterial(cms[i]);
14387+
}
1431814388

1431914389
this.world.off("beginContact", this.beginContactHandler, this);
1432014390
this.world.off("endContact", this.endContactHandler, this);
@@ -14325,7 +14395,6 @@ Phaser.Physics.P2.prototype = {
1432514395

1432614396
this.collisionGroups = [];
1432714397
this._toRemove = [];
14328-
this._collisionGroupID = 2;
1432914398
this.boundsCollidesWith = [];
1433014399

1433114400
},
@@ -16622,6 +16691,11 @@ Phaser.Physics.P2.Body.prototype = {
1662216691
this.sprite.rotation = this.data.angle;
1662316692
}
1662416693

16694+
if (this.debugBody)
16695+
{
16696+
this.debugBody.updateSpriteTransform();
16697+
}
16698+
1662516699
},
1662616700

1662716701
/**
@@ -16714,7 +16788,7 @@ Phaser.Physics.P2.Body.prototype = {
1671416788

1671516789
if (this.debugBody)
1671616790
{
16717-
this.debugBody.destroy();
16791+
this.debugBody.destroy(true, true);
1671816792
}
1671916793

1672016794
this.debugBody = null;
@@ -17784,17 +17858,6 @@ Phaser.Physics.P2.BodyDebug.prototype.constructor = Phaser.Physics.P2.BodyDebug;
1778417858

1778517859
Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
1778617860

17787-
/**
17788-
* Core update.
17789-
*
17790-
* @method Phaser.Physics.P2.BodyDebug#update
17791-
*/
17792-
update: function() {
17793-
17794-
this.updateSpriteTransform();
17795-
17796-
},
17797-
1779817861
/**
1779917862
* Core update.
1780017863
*
@@ -17804,8 +17867,7 @@ Phaser.Utils.extend(Phaser.Physics.P2.BodyDebug.prototype, {
1780417867

1780517868
this.position.x = this.body.position[0] * this.ppu;
1780617869
this.position.y = this.body.position[1] * this.ppu;
17807-
17808-
return this.rotation = this.body.angle;
17870+
this.rotation = this.body.angle;
1780917871

1781017872
},
1781117873

build/custom/p2.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)