Class Camera

Represents a camera object used for rendering and controlling the view of a scene.

Constructors

Properties

bounded: boolean = true

Camera bounds. If true, camera will not go outside the game world.

followEntity?: Entity

Entity to follow

isShaking: boolean = false

Is camera shaking

offset: Vector = ...

Camera shake offset

pos: Vector = ...

Camera position

scale: number = 1

Camera scale (zoom)

scene: Scene

Scene object

scrolling: boolean = true

Scrolling mode (smooth or switch between views without scrolling)

shakeDuration: number = 0

Shake duration

shakeElapsed: number = 0

Shake elapsed time

shakeIntensity: Vector = ...

Shake intensity

speed: Vector = ...

Camera horizontal and vertical speed scale (percent). 0 - no movement, 1 - instant movement

Methods

  • Sets the scrolling behavior of the camera.

    Parameters

    • scrolling: boolean

      A boolean value indicating whether scrolling is enabled or disabled.

    Returns void

  • Shakes the camera for a specified duration with a given intensity.

    Parameters

    • duration: number

      The duration of the camera shake in seconds.

    • intensity: Vector

      The intensity of the camera shake as a Vector.

    Returns void

  • Toggles the bounds of the camera.

    Parameters

    • bounded: boolean

      A boolean value indicating whether the camera should be bounded or not.

    Returns void