Phaser API Documentation

  Version: 
Filter
Namespace: Bounce
Phaser.Physics.Arcade.Components.Bounce

Methods

setBounce(x, [y])
Focus
Focus

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:

name type arguments Default description
x number

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

y number <optional> x

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

Returns:
Description:

This Game Object.

Since: 3.0.0
Focus
Focus
setBounceX(value)
Focus
Focus

Description:

Sets the horizontal bounce value for this body.

Parameters:

name type description
value number

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

Returns:
Description:

This Game Object.

Since: 3.0.0
Focus
Focus
setBounceY(value)
Focus
Focus

Description:

Sets the vertical bounce value for this body.

Parameters:

name type description
value number

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

Returns:
Description:

This Game Object.

Since: 3.0.0
Focus
Focus
setCollideWorldBounds([value], [bounceX], [bounceY])
Focus
Focus

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:

name type arguments Default description
value boolean <optional> true

true if this body should collide with the world bounds, otherwise false.

bounceX number <optional>

If given this will be replace the worldBounce.x value.

bounceY number <optional>

If given this will be replace the worldBounce.y value.

Returns:
Description:

This Game Object.

Since: 3.0.0
Focus
Focus