phaser - v4.0.0-rc.4
    Preparing search index...

    A Fixed Key Camera Control.

    This allows you to control the movement and zoom of a camera using the defined keys.

    var camControl = new FixedKeyControl({
    camera: this.cameras.main,
    left: cursors.left,
    right: cursors.right,
    speed: float OR { x: 0, y: 0 }
    });

    Movement is precise and has no 'smoothing' applied to it.

    You must call the update method of this controller every frame.

    Index

    Constructors

    Properties

    active: boolean

    A flag controlling if the Controls will update the Camera or not.

    The Camera that this Control will update.

    down: Key

    The Key to be pressed that will move the Camera down.

    left: Key

    The Key to be pressed that will move the Camera left.

    maxZoom: number

    The largest zoom value the camera will reach when zoomed in.

    minZoom: number

    The smallest zoom value the camera will reach when zoomed out.

    right: Key

    The Key to be pressed that will move the Camera right.

    speedX: number

    The horizontal speed the camera will move.

    speedY: number

    The vertical speed the camera will move.

    up: Key

    The Key to be pressed that will move the Camera up.

    zoomIn: Key

    The Key to be pressed that will zoom the Camera in.

    zoomOut: Key

    The Key to be pressed that will zoom the Camera out.

    zoomSpeed: number

    The speed at which the camera will zoom if the zoomIn or zoomOut keys are pressed.

    Methods

    • Starts the Key Control running, providing it has been linked to a camera.

      Returns this

    • Stops this Key Control from running. Call start to start it again.

      Returns this

    • Applies the results of pressing the control keys to the Camera.

      You must call this every step, it is not called automatically.

      Parameters

      • delta: number

        The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.

      Returns void