Adds a new Camera into the Camera Manager. The Camera Manager can support up to 31 different Cameras.
Each Camera has its own viewport, which controls the size of the Camera and its position within the canvas.
Use the Camera.scrollX
and Camera.scrollY
properties to change where the Camera is looking, or the
Camera methods such as centerOn
. Cameras also have built in special effects, such as fade, flash, shake,
pan and zoom.
By default Cameras are transparent and will render anything that they can see based on their scrollX
and scrollY
values. Game Objects can be set to be ignored by a Camera by using the Camera.ignore
method.
The Camera will have its roundPixels
property set to whatever CameraManager.roundPixels
is. You can change
it after creation if required.
See the Camera class documentation for more details.
name | type | arguments | Default | description |
---|---|---|---|---|
x | number | <optional> | 0 |
The horizontal position of the Camera viewport. |
y | number | <optional> | 0 |
The vertical position of the Camera viewport. |
width | number | <optional> |
The width of the Camera viewport. If not given it'll be the game config size. |
|
height | number | <optional> |
The height of the Camera viewport. If not given it'll be the game config size. |
|
makeMain | boolean | <optional> | false |
Set this Camera as being the 'main' camera. This just makes the property |
name | string | <optional> | '' |
The name of the Camera. |
The newly created Camera.