mirror of
https://github.com/wassname/phaser.git
synced 2026-10-01 12:21:02 +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:
1 parent
243820c973
commit
e8b432f518
3 files changed
+16
-2
No files matched your search
@@ -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