Fixed bug where changing State would cause the camera to not reset if it was following an object.

World.reset now calls Camera.reset which sends the camera back to 0,0 and un-follows any object it may have been tracking.
This commit is contained in:
photonstorm
2014-02-08 13:45:18 +00:00
parent 243820c973
commit e8b432f518
3 changed files with 16 additions and 2 deletions
+13
View File
@@ -330,6 +330,19 @@ Phaser.Camera.prototype = {
this.view.width = width;
this.view.height = height;
},
/**
* Resets the camera back to 0,0 and un-follows any object it may have been tracking.
*
* @method Phaser.Camera#reset
*/
reset: function () {
this.target = null;
this.camera.x = 0;
this.camera.y = 0;
}
};
+1 -2
View File
@@ -178,8 +178,7 @@ Phaser.World.prototype.setBounds = function (x, y, width, height) {
*/
Phaser.World.prototype.destroy = function () {
this.camera.x = 0;
this.camera.y = 0;
this.camera.reset();
this.game.input.reset(true);