Skip to content

Commit 1fe3319

Browse files
committed
Added in p2.total
1 parent 9f997da commit 1fe3319

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Version 2.0.0 - "Aes Sedai" - -in development-
4444

4545
Significant API changes:
4646

47-
* Upgraded to Pixi.js 1.5.2
47+
* Upgraded to Pixi.js 1.5.5
4848
* Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting and child iteration.
4949
* Removed Sprite.group property. You can use Sprite.parent for all similar needs now.
5050
* PIXI.Point is now aliased to Phaser.Point - saves on code duplication and works exactly the same.
@@ -72,7 +72,7 @@ Significant API changes:
7272
* World preUpdate, update and postUpdate have all been moved to Stage. So all children are updated regardless where on the display list they live.
7373
* Cache.getImageKeys and similar has been removed, please use Cache.getKeys(Phaser.Cache.IMAGE) instead, this now supports all 10 Cache data types.
7474
* After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required.
75-
* Phaser.QuadTree has been removed from core and moved to a plugin. It's no longer required, nor works with the physics system.
75+
* Phaser.QuadTree has been made more generic and works with any rectangle, not just physics bodies.
7676
* Phaser.Animation.frame now returns the frame of the current animation, rather than the global frame from the sprite sheet / atlas.
7777
* When adding a Group if the parent value is `null` the Group won't be added to the World, so you can add it when ready. If parent is `undefined` it's added by default.
7878
* The Keyboard class has had a complete overhaul. Phaser.Key objects are created automatically, there are fixes against duration and keys reset properly on visibility loss.
@@ -88,6 +88,7 @@ Significant API changes:
8888
* Debug methods that rendered geometry (Rectangle, Circle, Line, Point) have been merged into the single method: `Debug.geom`.
8989
* Animation.looped has been renamed to Animation.loop. It's a boolean you can toggle at run-time to turn on/off animation looping.
9090
* Sprite.damage will now kill the Sprite if health is less than or equal to 0 (before it would only kill if less than zero)
91+
* By default Sprites no longer check if they are within the world bounds. It's quite an expensive process (calling getBounds every frame), so you have to enable directly.
9192

9293

9394
New features:

src/physics/p2/World.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,3 +1073,18 @@ Object.defineProperty(Phaser.Physics.P2.prototype, "enableBodySleeping", {
10731073
}
10741074

10751075
});
1076+
1077+
/**
1078+
* @name Phaser.Physics.P2#total
1079+
* @property {number} total - The total number of bodies in the world.
1080+
* @readonly
1081+
*/
1082+
Object.defineProperty(Phaser.Physics.P2.prototype, "total", {
1083+
1084+
get: function () {
1085+
1086+
return this.world.bodies.length;
1087+
1088+
}
1089+
1090+
});

0 commit comments

Comments
 (0)