The Camera
Screen Size
The screen size determines the portion of the game world visible to the player. To adjust it, use the screenWidth
and screenHeight
parameters:
Camera Tracking
For smooth player tracking, define an invisible central rectangle around which the camera will automatically adjust. If the player moves outside of this rectangle, the camera will reposition to keep the player in view:
Warning
To achieve smooth tracking, you must set values for both
cameraWidth
andcameraHeight
.