new SmoothedKeyControl(config)
Parameters:
Name | Type | Description |
---|---|---|
config |
Phaser.Types.Cameras.Controls.SmoothedKeyControlConfig | The Smoothed Key Control configuration object. |
- Since: 3.0.0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 10)
Members
-
accelX :number
-
The horizontal acceleration the camera will move.
Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 128)
-
accelY :number
-
The vertical acceleration the camera will move.
Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 138)
-
active :boolean
-
A flag controlling if the Controls will update the Camera or not.
Type:
- boolean
- Since: 3.0.0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 260)
-
<nullable> camera :Phaser.Cameras.Scene2D.Camera
-
The Camera that this Control will update.
Type:
- Since: 3.0.0
- Default Value:
-
- null
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 48)
-
<nullable> down :Phaser.Input.Keyboard.Key
-
The Key to be pressed that will move the Camera down.
Type:
- Since: 3.0.0
- Default Value:
-
- null
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 88)
-
dragX :number
-
The horizontal drag applied to the camera when it is moving.
Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 161)
-
dragY :number
-
The vertical drag applied to the camera when it is moving.
Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 171)
-
<nullable> left :Phaser.Input.Keyboard.Key
-
The Key to be pressed that will move the Camera left.
Type:
- Since: 3.0.0
- Default Value:
-
- null
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 58)
-
maxSpeedX :number
-
The maximum horizontal speed the camera will move.
Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 194)
-
maxSpeedY :number
-
The maximum vertical speed the camera will move.
Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 204)
-
<nullable> right :Phaser.Input.Keyboard.Key
-
The Key to be pressed that will move the Camera right.
Type:
- Since: 3.0.0
- Default Value:
-
- null
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 68)
-
<nullable> up :Phaser.Input.Keyboard.Key
-
The Key to be pressed that will move the Camera up.
Type:
- Since: 3.0.0
- Default Value:
-
- null
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 78)
-
<nullable> zoomIn :Phaser.Input.Keyboard.Key
-
The Key to be pressed that will zoom the Camera in.
Type:
- Since: 3.0.0
- Default Value:
-
- null
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 98)
-
<nullable> zoomOut :Phaser.Input.Keyboard.Key
-
The Key to be pressed that will zoom the Camera out.
Type:
- Since: 3.0.0
- Default Value:
-
- null
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 108)
-
zoomSpeed :number
-
The speed at which the camera will zoom if the
zoomIn
orzoomOut
keys are pressed.Type:
- number
- Since: 3.0.0
- Default Value:
-
- 0.01
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 118)
Methods
-
destroy()
-
Destroys this Key Control.
- Since: 3.0.0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 456)
-
setCamera(camera)
-
Binds this Key Control to a camera.
Parameters:
Name Type Description camera
Phaser.Cameras.Scene2D.Camera The camera to bind this Key Control to.
- Since: 3.0.0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 300)
Returns:
This Key Control instance.
-
start()
-
Starts the Key Control running, providing it has been linked to a camera.
- Since: 3.0.0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 270)
Returns:
This Key Control instance.
-
stop()
-
Stops this Key Control from running. Call
start
to start it again.- Since: 3.0.0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 285)
Returns:
This Key Control instance.
-
update(delta)
-
Applies the results of pressing the control keys to the Camera.
You must call this every step, it is not called automatically.
Parameters:
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.
- Since: 3.0.0
- Source: src/cameras/controls/SmoothedKeyControl.js (Line 317)