Phaser API Documentation

  Version: 
getScroll(x, y, [out])

Description:

Calculates what the Camera.scrollX and scrollY values would need to be in order to move the Camera so it is centered on the given x and y coordinates, without actually moving the Camera there. The results are clamped based on the Camera bounds, if set.

Parameters:

name type arguments description
x number

The horizontal coordinate to center on.

y number

The vertical coordinate to center on.

out Phaser.Math.Vector2 <optional>

A Vector2 to store the values in. If not given a new Vector2 is created.

Returns:
Description:

The scroll coordinates stored in the x and y properties.

Since: 3.11.0