Phaser API Documentation

  Version: 
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:

name type arguments 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.

Returns:
Description:

This Game Object.

Since: 3.0.0