mirror of
https://github.com/wassname/phaser.git
synced 2026-08-02 13:00:25 +08:00
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:
@@ -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
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user