@@ -590,35 +590,78 @@ var BaseCamera = new Class({
590590 } ,
591591
592592 /**
593- * Moves the Camera so that it is centered on the given coordinates, bounds allowing.
593+ * Moves the Camera horizontally so that it is centered on the given x coordinate, bounds allowing.
594+ * Calling this does not change the scrollY value.
594595 *
595- * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn
596- * @since 3.11 .0
596+ * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnX
597+ * @since 3.16 .0
597598 *
598599 * @param {number } x - The horizontal coordinate to center on.
599- * @param {number } y - The vertical coordinate to center on.
600600 *
601601 * @return {Phaser.Cameras.Scene2D.BaseCamera } This Camera instance.
602602 */
603- centerOn : function ( x , y )
603+ centerOnX : function ( x )
604604 {
605605 var originX = this . width * 0.5 ;
606- var originY = this . height * 0.5 ;
607606
608- this . midPoint . set ( x , y ) ;
607+ this . midPoint . x = x ;
609608
610609 this . scrollX = x - originX ;
611- this . scrollY = y - originY ;
612610
613611 if ( this . useBounds )
614612 {
615613 this . scrollX = this . clampX ( this . scrollX ) ;
614+ }
615+
616+ return this ;
617+ } ,
618+
619+ /**
620+ * Moves the Camera vertically so that it is centered on the given y coordinate, bounds allowing.
621+ * Calling this does not change the scrollX value.
622+ *
623+ * @method Phaser.Cameras.Scene2D.BaseCamera#centerOnY
624+ * @since 3.16.0
625+ *
626+ * @param {number } y - The vertical coordinate to center on.
627+ *
628+ * @return {Phaser.Cameras.Scene2D.BaseCamera } This Camera instance.
629+ */
630+ centerOnY : function ( y )
631+ {
632+ var originY = this . height * 0.5 ;
633+
634+ this . midPoint . y = y ;
635+
636+ this . scrollY = y - originY ;
637+
638+ if ( this . useBounds )
639+ {
616640 this . scrollY = this . clampY ( this . scrollY ) ;
617641 }
618642
619643 return this ;
620644 } ,
621645
646+ /**
647+ * Moves the Camera so that it is centered on the given coordinates, bounds allowing.
648+ *
649+ * @method Phaser.Cameras.Scene2D.BaseCamera#centerOn
650+ * @since 3.11.0
651+ *
652+ * @param {number } x - The horizontal coordinate to center on.
653+ * @param {number } y - The vertical coordinate to center on.
654+ *
655+ * @return {Phaser.Cameras.Scene2D.BaseCamera } This Camera instance.
656+ */
657+ centerOn : function ( x , y )
658+ {
659+ this . centerOnX ( x ) ;
660+ this . centerOnY ( y ) ;
661+
662+ return this ;
663+ } ,
664+
622665 /**
623666 * Moves the Camera so that it is looking at the center of the Camera Bounds, if enabled.
624667 *
0 commit comments