Phaser.Component. FixedToCamera

new FixedToCamera()

The FixedToCamera component enables a Game Object to be rendered relative to the game camera coordinates, regardless
of where in the world the camera is. This is used for things like sticking game UI to the camera that scrolls as it moves around the world.

Source - gameobjects/components/FixedToCamera.js, line 13

Members

cameraOffset :Phaser.Point

The x/y coordinate offset applied to the top-left of the camera that this Game Object will be drawn at if fixedToCamera is true.

The values are relative to the top-left of the camera view and in addition to any parent of the Game Object on the display list.

Source - gameobjects/components/FixedToCamera.js, line 85

fixedToCamera :boolean

A Game Object that is "fixed" to the camera is rendered at a given x/y offsets from the top left of the camera. The offsets
are stored in the cameraOffset property, which is initialized with the current object coordinates.

The values are adjusted at the rendering stage, overriding the Game Objects actual world position.

The end result is that the Game Object will appear to be 'fixed' to the camera, regardless of where in the game world
the camera is viewing. This is useful if for example this Game Object is a UI item that you wish to be visible at all times
regardless where in the world the camera is.

Note that the cameraOffset values are in addition to any parent of this Game Object on the display list.

Be careful not to set fixedToCamera on Game Objects which are in Groups that already have fixedToCamera enabled on them.

Source - gameobjects/components/FixedToCamera.js, line 55

Methods

<static> postUpdate()

The FixedToCamera component postUpdate handler.
Called automatically by the Game Object.

Source - gameobjects/components/FixedToCamera.js, line 21
Phaser Copyright © 2012-2016 Photon Storm Ltd.
Documentation generated by JSDoc 3.4.3 on Tue Dec 06 2016 23:48:58 GMT+0000 (GMT Standard Time) using the DocStrap template.