Phaser.Physics.Arcade.Components.Bounce

Scope: static

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

Methods:

Public Members

setBounce

<instance> setBounce(x, [y])

Description:

Sets the bounce values of this body.

Bounce is the amount of restitution, or elasticity, the body has when it collides with another object. A value of 1 means that it will retain its full velocity after the rebound. A value of 0 means it will not rebound at all.

Parameters:

nametypeoptionaldefaultdescription
xnumberNoThe amount of horizontal bounce to apply on collision. A float, typically between 0 and 1.
ynumberYes"x"The amount of vertical bounce to apply on collision. A float, typically between 0 and 1.

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

Source: src/physics/arcade/components/Bounce.js#L15
Since: 3.0.0


setBounceX

<instance> setBounceX(value)

Description:

Sets the horizontal bounce value for this body.

Parameters:

nametypeoptionaldescription
valuenumberNoThe amount of horizontal bounce to apply on collision. A float, typically between 0 and 1.

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

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


setBounceY

<instance> setBounceY(value)

Description:

Sets the vertical bounce value for this body.

Parameters:

nametypeoptionaldescription
valuenumberNoThe amount of vertical bounce to apply on collision. A float, typically between 0 and 1.

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

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


setCollideWorldBounds

<instance> setCollideWorldBounds([value], [bounceX], [bounceY], [onWorldBounds])

Description:

Sets whether this Body collides with the world boundary.

Optionally also sets the World Bounce values. If the Body.worldBounce is null, it's set to a new Phaser.Math.Vector2 first.

Parameters:

nametypeoptionaldefaultdescription
valuebooleanYestruetrue if this body should collide with the world bounds, otherwise false.
bounceXnumberYesIf given this will be replace the worldBounce.x value.
bounceYnumberYesIf given this will be replace the worldBounce.y value.
onWorldBoundsbooleanYesIf given this replaces the Body's onWorldBounds value.

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

Source: src/physics/arcade/components/Bounce.js#L70
Since: 3.0.0


Private Members

Updated on