Prevent a camera from going beyond the given camera dimensions.

Hierarchy

  • LimitCameraBoundsStrategy

Implements

Constructors

Properties

Methods

Constructors

Properties

boundSizeChecked: boolean = false

Useful for limiting the camera to a TileMap's dimensions, or a specific area inside the map.

Note that this strategy does not perform any movement by itself. It only sets the camera position to within the given bounds when the camera has gone beyond them. Thus, it is a good idea to combine it with other camera strategies and set this strategy as the last one.

Make sure that the camera bounds are at least as large as the viewport size.

Param

The bounding box to limit the camera to

target: BoundingBox

Target of the camera strategy that will be passed to the action

Methods

  • Camera strategies perform an action to calculate a new focus returned out of the strategy

    Parameters

    • target: BoundingBox

      The target object to apply this camera strategy (if any)

    • cam: Camera

      The current camera implementation in excalibur running the game

    • _eng: Engine

      The current engine running the game

    • _delta: number

      The elapsed time in milliseconds since the last frame

    Returns Vector