Provides methods used for setting the bounce properties of an Arcade Physics Body.
- Since: 3.0.0
- Source: src/physics/arcade/components/Bounce.js (Line 7)
Methods
-
setBounce(x [, y])
-
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 Argument 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.
- Since: 3.0.0
- Source: src/physics/arcade/components/Bounce.js (Line 15)
Returns:
This Game Object.
-
setBounceX(value)
-
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.
- Since: 3.0.0
- Source: src/physics/arcade/components/Bounce.js (Line 36)
Returns:
This Game Object.
-
setBounceY(value)
-
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.
- Since: 3.0.0
- Source: src/physics/arcade/components/Bounce.js (Line 53)
Returns:
This Game Object.
-
setCollideWorldBounds( [value] [, bounceX] [, bounceY])
-
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 Argument Default Description value
boolean <optional>
true true
if this body should collide with the world bounds, otherwisefalse
.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.- Since: 3.0.0
- Source: src/physics/arcade/components/Bounce.js (Line 70)
Returns:
This Game Object.