Skip to main content

LimitCameraBoundsStrategy

Prevent a camera from going beyond the given camera dimensions.

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

boundSizeChecked

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

publictarget

target: BoundingBox

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

Methods

publicaction

  • 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<any>

      The current engine running the game

    • _delta: number

      The elapsed time in milliseconds since the last frame

    Returns Vector