new Camera(game, id, x, y, width, height)
A Camera is your view into the game world. It has a position and size and renders only those objects within its field of view.
The game automatically creates a single Stage sized camera on boot. Move the camera around the world with Phaser.Camera.x/y
Parameters:
Name | Type | Description |
---|---|---|
game |
Phaser.Game | Game reference to the currently running game. |
id |
number | Not being used at the moment, will be when Phaser supports multiple camera |
x |
number | Position of the camera on the X axis |
y |
number | Position of the camera on the Y axis |
width |
number | The width of the view rectangle |
height |
number | The height of the view rectangle |
- Source:
- core/Camera.js, line 23
Members
-
_edge
-
- Default Value:
- 0
- Source:
- core/Camera.js, line 81
Properties:
Name Type Description edge
number Edge property. Description. -
atLimit
-
- Source:
- core/Camera.js, line 69
Properties:
Name Type Description atLimit
bool Whether this camera is flush with the World Bounds or not. -
deadzone
-
- Source:
- core/Camera.js, line 58
Properties:
Name Type Description deadzone
Phaser.Rectangle Moving inside this Rectangle will not cause camera moving. -
game
-
- Source:
- core/Camera.js, line 28
Properties:
Name Type Description game
Phaser.Game A reference to the currently running Game. -
id
-
- Default Value:
- 0
- Source:
- core/Camera.js, line 39
Properties:
Name Type Description id
number Reserved for future multiple camera set-ups. -
screenView
-
- Source:
- core/Camera.js, line 53
Properties:
Name Type Description screenView
Phaser.Rectangle Used by Sprites to work out Camera culling. -
target
-
- Default Value:
- null
- Source:
- core/Camera.js, line 75
Properties:
Name Type Description target
Phaser.Sprite If the camera is tracking a Sprite, this is a reference to it, otherwise null. -
view
-
Camera view. The view into the world we wish to render (by default the game dimensions). The x/y values are in world coordinates, not screen coordinates, the width/height is how many pixels to render. Objects outside of this view are not rendered (unless set to ignore the Camera, i.e. UI?).
- Source:
- core/Camera.js, line 48
Properties:
Name Type Description view
Phaser.Rectangle -
visible
-
- Default Value:
- true
- Source:
- core/Camera.js, line 64
Properties:
Name Type Description visible
bool Whether this camera is visible or not. -
world
-
- Source:
- core/Camera.js, line 33
Properties:
Name Type Description world
Phaser.World A reference to the game world.