mirror of
https://github.com/photonstorm/phaser
synced 2024-11-15 17:28:18 +00:00
Fixed issue with physics world not being centered if you resized it.
This commit is contained in:
parent
1b5837d71d
commit
291f8ef14c
2 changed files with 8 additions and 3 deletions
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue