From 339da731605cb16b2f1a7dc5715fbe923fcf7cc8 Mon Sep 17 00:00:00 2001 From: Georgios Kaleadis Date: Thu, 24 Apr 2014 11:56:52 +0200 Subject: [PATCH] pausable p2 world --- src/physics/p2/World.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/physics/p2/World.js b/src/physics/p2/World.js index 642f7b4fc..46eae583f 100644 --- a/src/physics/p2/World.js +++ b/src/physics/p2/World.js @@ -627,10 +627,28 @@ Phaser.Physics.P2.prototype = { }, + /** + * @method Phaser.Physics.P2#update + */ + pause: function() { + this.paused = true + }, + + /** + * @method Phaser.Physics.P2#update + */ + resume: function() { + this.paused = false + }, + /** * @method Phaser.Physics.P2#update */ update: function () { + // do nothing when the pysics engine was paused before + if (this.paused){ + return + } if (this.useElapsedTime) {