Sets the Camera to follow a Game Object.
When enabled the Camera will automatically adjust its scroll position to keep the target Game Object in its center.
You can set the linear interpolation value used in the follow code. Use low lerp values (such as 0.1) to automatically smooth the camera motion.
If you find you're getting a slight "jitter" effect when following an object it's probably to do with sub-pixel
rendering of the targets position. This can be rounded by setting the
roundPixels argument to
force full pixel rounding rendering. Note that this can still be broken if you have specified a non-integer zoom
value on the camera. So be sure to keep the camera zoom to integers.
|target||object | Phaser.GameObjects.GameObject||
The target for the Camera to follow.
Round the camera position to whole integers to avoid sub-pixel rendering?
A value between 0 and 1. This value specifies the amount of linear interpolation to use when horizontally tracking the target. The closer the value to 1, the faster the camera will track.
A value between 0 and 1. This value specifies the amount of linear interpolation to use when vertically tracking the target. The closer the value to 1, the faster the camera will track.
The horizontal offset from the camera follow target.x position.
The vertical offset from the camera follow target.y position.
This Camera instance.