Camera

Module: engine.camera
new game.Camera([target])

Parameters:

  • target Container (optional)

Properties

acceleration Number (Default: 3)

Camera acceleration speed. Higher is faster.

container Container

Container, that the camera is moving.

limit Rectangle (Default: Infinity)

Limit the camera movement.

maxSpeed Number (Default: 200)

Camera maximum move speed.

offset Vector (Default: game.width / 2, game.height / 2)

Camera offset.

position Vector

Current position of the camera.

rounding Boolean (Default: true)

Round camera position.

sensorPosition Vector

Position of the camera sensor.

sensorSize Vector (Default: 200)

Size of the camera sensor.

speed Vector

Current speed of camera.

target Container

Container, that camera follows.

threshold Number

(No description yet)

Methods

_moveCamera()

(No description yet)

_moveSensor()

(No description yet)

_setPosition(x, y)

(No description yet)

Parameters:

  • x Number
  • y Number
_setSensorPosition()

(No description yet)

addTo(container)

Add camera to container.

Parameters:

  • container Container
setPosition(x, [y])

Set camera position.

Parameters:

  • x Number|Vector|Container
  • y Number (optional)
setTarget(target)

Set container, that the camera follows.

Parameters:

  • target Container
update()

Update camera position.