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 committed 2014-02-08 13:45:18 +00:00
1 parent 243820c973
commit e8b432f518
3 files changed
+16 -2

No files matched your search

+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);