Skip to content

Commit a1e5c26

Browse files
committed
Merge pull request phaserjs#757 from georgiee/pausable-pysics
[Enhancement] Pausable P2 World
2 parents 523c6c3 + 33fc41a commit a1e5c26

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/physics/p2/World.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,28 @@ Phaser.Physics.P2.prototype = {
627627

628628
},
629629

630+
/**
631+
* @method Phaser.Physics.P2#pause
632+
*/
633+
pause: function() {
634+
this.paused = true
635+
},
636+
637+
/**
638+
* @method Phaser.Physics.P2#resume
639+
*/
640+
resume: function() {
641+
this.paused = false
642+
},
643+
630644
/**
631645
* @method Phaser.Physics.P2#update
632646
*/
633647
update: function () {
648+
// do nothing when the pysics engine was paused before
649+
if (this.paused){
650+
return
651+
}
634652

635653
if (this.useElapsedTime)
636654
{

0 commit comments

Comments
 (0)