Skip to main content

PlatformCamera

Description:

  A platform camera for 2D platformer games that can track a game unit's movement and keep it within the camera's view.

Class Object: Platformer.PlatformCamera Class.

Inherits from: Camera.

position​

Type: Field.

Description:

  The camera's position.

Signature:

position: Vec2

rotation​

Type: Field.

Description:

  The camera's rotation in degrees.

Signature:

rotation: number

zoom​

Type: Field.

Description:

  The camera's zoom factor, 1.0 means the normal size, 2.0 mean zoom to doubled size.

Signature:

zoom: number

boundary​

Type: Field.

Description:

  The rectangular area within which the camera is allowed to view.

Signature:

boundary: Rect

followRatio​

Type: Field.

Description:

  The ratio at which the camera should move to keep up with the target's position. For example, set to Vec2(1.0, 1.0), then the camera will keep up to the target's position right away. Set to Vec2(0.5, 0.5) or smaller value, then the camera will move halfway to the target's position each frame, resulting in a smooth and gradual movement.

Signature:

followRatio: Vec2

followOffset​

Type: Field.

Description:

  The offset from the target's position that the camera should follow.

Signature:

followOffset: Vec2

followTarget​

Type: Field.

Description:

  The game unit that the camera should track.

Signature:

followTarget: Node