Phaser API Documentation

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

Methods

setFriction(x, [y])
Focus
Focus

Description:

Sets the friction of this game object's physics body. In Arcade Physics, friction is a special case of motion transfer from an "immovable" body to a riding body.

Parameters:

name type arguments Default description
x number

The amount of horizontal friction to apply, [0, 1].

y number <optional> x

The amount of vertical friction to apply, [0, 1].

Returns:
Description:

This Game Object.

Since: 3.0.0
Focus
Focus
setFrictionX(x)
Focus
Focus

Description:

Sets the horizontal friction of this game object's physics body. This can move a riding body horizontally when it collides with this one on the vertical axis.

Parameters:

name type description
x number

The amount of friction to apply, [0, 1].

Returns:
Description:

This Game Object.

Since: 3.0.0
Focus
Focus
setFrictionY(y)
Focus
Focus

Description:

Sets the vertical friction of this game object's physics body. This can move a riding body vertically when it collides with this one on the horizontal axis.

Parameters:

name type description
y number

The amount of friction to apply, [0, 1].

Returns:
Description:

This Game Object.

Since: 3.0.0
Focus
Focus