World.setBounds will now adjust the World.x/y values to match those given (#1555)

This commit is contained in:
photonstorm 2015-02-10 21:40:53 +00:00
parent cc7096b045
commit 7a066a3a8c
2 changed files with 5 additions and 1 deletions

View file

@ -120,6 +120,7 @@ Thanks to @pnstickne for vast majority of this update.
* TilemapParser will now set the `.type` property for ObjectLayer Objects (thanks @mikaturunen #1609) * TilemapParser will now set the `.type` property for ObjectLayer Objects (thanks @mikaturunen #1609)
* The Loader now directly calls StateManager.loadComplete rather than the StateManager listening for the loadComplete event, because Loader.reset unbinds this event (and it's easy to accidentally remove it too) * The Loader now directly calls StateManager.loadComplete rather than the StateManager listening for the loadComplete event, because Loader.reset unbinds this event (and it's easy to accidentally remove it too)
* Loader.onLoadComplete is dispatched *before* the Loader is reset. If you have a `create` method in your State please note that the Loader will have been reset before this method is called. This allows you to immediately re-use the Loader without having to first reset it manually. * Loader.onLoadComplete is dispatched *before* the Loader is reset. If you have a `create` method in your State please note that the Loader will have been reset before this method is called. This allows you to immediately re-use the Loader without having to first reset it manually.
* World.setBounds will now adjust the World.x/y values to match those given (#1555)
### Bug Fixes ### Bug Fixes

View file

@ -76,7 +76,7 @@ Phaser.World.prototype.boot = function () {
}; };
/** /**
* Updates the size of this world. Note that this doesn't modify the world x/y coordinates, just the width and height. * Updates the size of this world and sets World.x/y to the given values
* The Camera bounds and Physics bounds (if set) are also updated to match the new World bounds. * The Camera bounds and Physics bounds (if set) are also updated to match the new World bounds.
* *
* @method Phaser.World#setBounds * @method Phaser.World#setBounds
@ -93,6 +93,9 @@ Phaser.World.prototype.setBounds = function (x, y, width, height) {
this.bounds.setTo(x, y, width, height); this.bounds.setTo(x, y, width, height);
this.x = x;
this.y = y;
if (this.camera.bounds) if (this.camera.bounds)
{ {
// The Camera can never be smaller than the game size // The Camera can never be smaller than the game size