Phaser.Physics.Arcade.Components.Gravity

Scope: static

Source: src/physics/arcade/components/Gravity.js#L7
Since: 3.0.0

Methods:

Public Members

setGravity

<instance> setGravity(x, [y])

Description:

Set the X and Y values of the gravitational pull to act upon this Arcade Physics Game Object. Values can be positive or negative. Larger values result in a stronger effect.

If only one value is provided, this value will be used for both the X and Y axis.

Parameters:

nametypeoptionaldefaultdescription
xnumberNoThe gravitational force to be applied to the X-axis.
ynumberYes"x"The gravitational force to be applied to the Y-axis. If this is not specified, the X value will be used.

Returns: Phaser.Physics.Arcade.Components.Gravity - This Game Object.

Source: src/physics/arcade/components/Gravity.js#L16
Since: 3.0.0


setGravityX

<instance> setGravityX(x)

Description:

Set the gravitational force to be applied to the X axis. Value can be positive or negative. Larger values result in a stronger effect.

Parameters:

nametypeoptionaldescription
xnumberNoThe gravitational force to be applied to the X-axis.

Returns: Phaser.Physics.Arcade.Components.Gravity - This Game Object.

Source: src/physics/arcade/components/Gravity.js#L36
Since: 3.0.0


setGravityY

<instance> setGravityY(y)

Description:

Set the gravitational force to be applied to the Y axis. Value can be positive or negative. Larger values result in a stronger effect.

Parameters:

nametypeoptionaldescription
ynumberNoThe gravitational force to be applied to the Y-axis.

Returns: Phaser.Physics.Arcade.Components.Gravity - This Game Object.

Source: src/physics/arcade/components/Gravity.js#L53
Since: 3.0.0


Private Members

Updated on