Provides methods for setting the gravity properties of an Arcade Physics Game Object. Should be applied as a mixin and not used directly.
- Since: 3.0.0
- Source: src/physics/arcade/components/Gravity.js (Line 7)
Methods
-
setGravity(x [, y])
-
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:
Name Type Argument Default Description x
number The gravitational force to be applied to the X-axis.
y
number <optional>
x The gravitational force to be applied to the Y-axis. If this is not specified, the X value will be used.
- Since: 3.0.0
- Source: src/physics/arcade/components/Gravity.js (Line 16)
Returns:
This Game Object.
-
setGravityX(x)
-
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:
Name Type Description x
number The gravitational force to be applied to the X-axis.
- Since: 3.0.0
- Source: src/physics/arcade/components/Gravity.js (Line 36)
Returns:
This Game Object.
-
setGravityY(y)
-
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:
Name Type Description y
number The gravitational force to be applied to the Y-axis.
- Since: 3.0.0
- Source: src/physics/arcade/components/Gravity.js (Line 53)
Returns:
This Game Object.