diff --git a/src/cameras/2d/Camera.js b/src/cameras/2d/Camera.js index 1579ed7ea..1529124f8 100644 --- a/src/cameras/2d/Camera.js +++ b/src/cameras/2d/Camera.js @@ -1284,6 +1284,40 @@ var Camera = new Class({ this._bounds = null; this.scene = null; + }, + + /** + * The x position of the center of the Camera's viewport, relative to the top-left of the game canvas. + * + * @name Phaser.Cameras.Scene2D.Camera#centerX + * @type {number} + * @readOnly + * @since 3.10.0 + */ + centerX: { + + get: function () + { + return this.x + (0.5 * this.width); + } + + }, + + /** + * The y position of the center of the Camera's viewport, relative to the top-left of the game canvas. + * + * @name Phaser.Cameras.Scene2D.Camera#centerY + * @type {number} + * @readOnly + * @since 3.10.0 + */ + centerY: { + + get: function () + { + return this.y + (0.5 * this.height); + } + } });