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.
new FixedKeyControl(config)
name | type | description |
---|---|---|
config | Phaser.Types.Cameras.Controls.FixedKeyControlConfig |
The Fixed Key Control configuration object. |
A flag controlling if the Controls will update the Camera or not.
The Camera that this Control will update.
The Key to be pressed that will move the Camera down.
The Key to be pressed that will move the Camera left.
The largest zoom value the camera will reach when zoomed in.
The smallest zoom value the camera will reach when zoomed out.
The Key to be pressed that will move the Camera right.
The horizontal speed the camera will move.
The vertical speed the camera will move.
The Key to be pressed that will move the Camera up.
The Key to be pressed that will zoom the Camera in.
The Key to be pressed that will zoom the Camera out.
The speed at which the camera will zoom if the zoomIn
or zoomOut
keys are pressed.
Destroys this Key Control.
Binds this Key Control to a camera.
name | type | description |
---|---|---|
camera | Phaser.Cameras.Scene2D.Camera |
The camera to bind this Key Control to. |
This Key Control instance.
Starts the Key Control running, providing it has been linked to a camera.
This Key Control instance.
Stops this Key Control from running. Call start
to start it again.
This Key Control instance.
Applies the results of pressing the control keys to the Camera.
You must call this every step, it is not called automatically.
name | type | description |
---|---|---|
delta | number |
The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. |