Class: Camera

Camera

Camera

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

Properties:
Name Type Description
edge number Edge property. Description.
Default Value:
  • 0
Source:
  • core/Camera.js, line 81

atLimit

Properties:
Name Type Description
atLimit bool Whether this camera is flush with the World Bounds or not.
Source:
  • core/Camera.js, line 69

deadzone

Properties:
Name Type Description
deadzone Phaser.Rectangle Moving inside this Rectangle will not cause camera moving.
Source:
  • core/Camera.js, line 58

game

Properties:
Name Type Description
game Phaser.Game A reference to the currently running Game.
Source:
  • core/Camera.js, line 28

id

Properties:
Name Type Description
id number Reserved for future multiple camera set-ups.
Default Value:
  • 0
Source:
  • core/Camera.js, line 39

screenView

Properties:
Name Type Description
screenView Phaser.Rectangle Used by Sprites to work out Camera culling.
Source:
  • core/Camera.js, line 53

target

Properties:
Name Type Description
target Phaser.Sprite If the camera is tracking a Sprite, this is a reference to it, otherwise null.
Default Value:
  • null
Source:
  • core/Camera.js, line 75

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?).
Properties:
Name Type Description
view Phaser.Rectangle
Source:
  • core/Camera.js, line 48

visible

Properties:
Name Type Description
visible bool Whether this camera is visible or not.
Default Value:
  • true
Source:
  • core/Camera.js, line 64

world

Properties:
Name Type Description
world Phaser.World A reference to the game world.
Source:
  • core/Camera.js, line 33