diff --git a/examples/sprites/out of bounds.js b/examples/sprites/out of bounds.js index 94ffc31f..23b7a51c 100644 --- a/examples/sprites/out of bounds.js +++ b/examples/sprites/out of bounds.js @@ -13,6 +13,10 @@ var aliens; function create() { + // We only want world bounds on the left and right + game.physics.setBoundsToWorld(true, true, false, false); + game.physics.friction = 0; + player = game.add.sprite(400, 500, 'ship'); player.anchor.setTo(0.5, 0.5); @@ -24,7 +28,9 @@ function create() { { var alien = aliens.create(200 + x * 48, y * 50, 'alien'); alien.name = 'alien' + x.toString() + y.toString(); + alien.checkWorldBounds = true; alien.events.onOutOfBounds.add(alienOut, this); + alien.physicsEnabled = true; alien.body.velocity.y = 50 + Math.random() * 200; } } diff --git a/src/physics/Body.js b/src/physics/Body.js index 8c351911..a800f720 100644 --- a/src/physics/Body.js +++ b/src/physics/Body.js @@ -1467,13 +1467,13 @@ Object.defineProperty(Phaser.Physics.Body.prototype, "x", { get: function () { - return this.p2px(this.data.position[0]); + return this.p2pxi(this.data.position[0]); }, set: function (value) { - this.data.position[0] = this.px2p(value); + this.data.position[0] = this.px2pi(value); } @@ -1487,13 +1487,13 @@ Object.defineProperty(Phaser.Physics.Body.prototype, "y", { get: function () { - return this.p2px(this.data.position[1]); + return this.p2pxi(this.data.position[1]); }, set: function (value) { - this.data.position[1] = this.px2p(value); + this.data.position[1] = this.px2pi(value); }