diff --git a/examples/wip/p25.js b/examples/wip/p25.js index 3b98e37a..9cf55a09 100644 --- a/examples/wip/p25.js +++ b/examples/wip/p25.js @@ -62,8 +62,8 @@ function update() { function render() { - // game.debug.renderText('x: ' + box2.body.velocity.x, 32, 32); - // game.debug.renderText('y: ' + box2.body.velocity.y, 32, 64); + game.debug.renderText('x: ' + ship.body.x, 32, 32); + game.debug.renderText('y: ' + ship.body.y, 32, 64); } diff --git a/src/physics/World.js b/src/physics/World.js index 689e8cb7..3b567a70 100644 --- a/src/physics/World.js +++ b/src/physics/World.js @@ -168,11 +168,16 @@ Phaser.Physics.World.prototype.setBounds = function (x, y, width, height, left, { this.removeBody(this.bounds); - for (var i = this.bounds.shapes.length - 1; i >= 0; i--) + var i = this.bounds.shapes.length; + + while (i--) { var shape = this.bounds.shapes[i]; this.bounds.removeShape(shape); } + + this.bounds.position[0] = this.game.math.px2p(cx); + this.bounds.position[1] = this.game.math.px2p(cy); } else {