Added position Point object for quick x/y coordinates access.

This commit is contained in:
Darek Zieliński 2014-07-14 20:03:34 +02:00
parent ff5dda7e82
commit ee1df55d84

View file

@ -406,6 +406,30 @@ Object.defineProperty(Phaser.Camera.prototype, "y", {
}); });
/**
* The Cameras position. This value is automatically clamped if it falls outside of the World bounds.
* @name Phaser.Camera#position
* @property {Phaser.Point} position - Gets or sets the cameras xy position using Phaser.Point object.
*/
Object.defineProperty(Phaser.Camera.prototype, "position", {
get: function () {
return new Phaser.Point(this.view.centerX, this.view.centerY);
},
set: function (value) {
this.view.x = value.x;
this.view.y = value.y;
if (this.bounds)
{
this.checkBounds();
}
}
});
/** /**
* The Cameras width. By default this is the same as the Game size and should not be adjusted for now. * The Cameras width. By default this is the same as the Game size and should not be adjusted for now.
* @name Phaser.Camera#width * @name Phaser.Camera#width