Phaser.Physics.Arcade

Scope: static

Source: src/physics/arcade/index.js#L10

Classs:

Public Members

Private Members

Namespaces:

Public Members

Private Members

Public Members

DYNAMIC_BODY

DYNAMIC_BODY: number

Description:

Dynamic Body.

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


FACING_DOWN

FACING_DOWN: number

Description:

Facing down.

Source: src/physics/arcade/const.js#L85
Since: 3.0.0


FACING_LEFT

FACING_LEFT: number

Description:

Facing left.

Source: src/physics/arcade/const.js#L97
Since: 3.0.0


FACING_NONE

FACING_NONE: number

Description:

Facing no direction (initial value).

Source: src/physics/arcade/const.js#L61
Since: 3.0.0


FACING_RIGHT

FACING_RIGHT: number

Description:

Facing right.

Source: src/physics/arcade/const.js#L109
Since: 3.0.0


FACING_UP

FACING_UP: number

Description:

Facing up.

Source: src/physics/arcade/const.js#L73
Since: 3.0.0


GROUP

GROUP: number

Description:

Arcade Physics Group containing Dynamic Bodies.

Source: src/physics/arcade/const.js#L41
Since: 3.0.0


STATIC_BODY

STATIC_BODY: number

Description:

Static Body.

Source: src/physics/arcade/const.js#L28
Since: 3.0.0


TILEMAPLAYER

TILEMAPLAYER: number

Description:

A Tilemap Layer.

Source: src/physics/arcade/const.js#L51
Since: 3.0.0


Private Members

Methods:

Public Members

GetCollidesWith

<static> GetCollidesWith(categories)

Description:

Calculates and returns the bitmask needed to determine if the given categories will collide with each other or not.

Parameters:

nametypeoptionaldescription
categoriesnumber | Array.<number>NoA unique category bitfield, or an array of them.

Returns: number - The collision mask.

Source: src/physics/arcade/GetCollidesWith.js#L7
Since: 3.70.0


GetOverlapX

<static> GetOverlapX(body1, body2, overlapOnly, bias)

Description:

Calculates and returns the horizontal overlap between two arcade physics bodies and sets their properties accordingly, including: touching.left, touching.right, touching.none and `overlapX'.

Parameters:

nametypeoptionaldescription
body1Phaser.Physics.Arcade.BodyNoThe first Body to separate.
body2Phaser.Physics.Arcade.BodyNoThe second Body to separate.
overlapOnlybooleanNoIs this an overlap only check, or part of separation?
biasnumberNoA value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding).

Returns: number - The amount of overlap.

Source: src/physics/arcade/GetOverlapX.js#L9
Since: 3.0.0


GetOverlapY

<static> GetOverlapY(body1, body2, overlapOnly, bias)

Description:

Calculates and returns the vertical overlap between two arcade physics bodies and sets their properties accordingly, including: touching.up, touching.down, touching.none and `overlapY'.

Parameters:

nametypeoptionaldescription
body1Phaser.Physics.Arcade.BodyNoThe first Body to separate.
body2Phaser.Physics.Arcade.BodyNoThe second Body to separate.
overlapOnlybooleanNoIs this an overlap only check, or part of separation?
biasnumberNoA value added to the delta values during collision checks. Increase it to prevent sprite tunneling(sprites passing through another instead of colliding).

Returns: number - The amount of overlap.

Source: src/physics/arcade/GetOverlapY.js#L9
Since: 3.0.0


SeparateX

<static> SeparateX(body1, body2, overlapOnly, bias, [overlap])

Description:

Separates two overlapping bodies on the X-axis (horizontally).

Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection.

The bodies won't be separated if there is no horizontal overlap between them, if they are static, or if either one uses custom logic for its separation.

Parameters:

nametypeoptionaldescription
body1Phaser.Physics.Arcade.BodyNoThe first Body to separate.
body2Phaser.Physics.Arcade.BodyNoThe second Body to separate.
overlapOnlybooleanNoIf true, the bodies will only have their overlap data set and no separation will take place.
biasnumberNoA value to add to the delta value during overlap checking. Used to prevent sprite tunneling.
overlapnumberYesIf given then this value will be used as the overlap and no check will be run.

Returns: boolean - true if the two bodies overlap vertically, otherwise false.

Source: src/physics/arcade/SeparateX.js#L10
Since: 3.0.0


SeparateY

<static> SeparateY(body1, body2, overlapOnly, bias, [overlap])

Description:

Separates two overlapping bodies on the Y-axis (vertically).

Separation involves moving two overlapping bodies so they don't overlap anymore and adjusting their velocities based on their mass. This is a core part of collision detection.

The bodies won't be separated if there is no vertical overlap between them, if they are static, or if either one uses custom logic for its separation.

Parameters:

nametypeoptionaldescription
body1Phaser.Physics.Arcade.BodyNoThe first Body to separate.
body2Phaser.Physics.Arcade.BodyNoThe second Body to separate.
overlapOnlybooleanNoIf true, the bodies will only have their overlap data set and no separation will take place.
biasnumberNoA value to add to the delta value during overlap checking. Used to prevent sprite tunneling.
overlapnumberYesIf given then this value will be used as the overlap and no check will be run.

Returns: boolean - true if the two bodies overlap vertically, otherwise false.

Source: src/physics/arcade/SeparateY.js#L10
Since: 3.0.0


SetCollisionObject

<static> SetCollisionObject(noneFlip, [data])

Description:

Either sets or creates the Arcade Body Collision object.

Mostly only used internally.

Parameters:

nametypeoptionaldescription
noneFlipbooleanNoIs none true or false?
dataPhaser.Types.Physics.Arcade.ArcadeBodyCollisionYesThe collision data object to populate, or create if not given.

Returns: Phaser.Types.Physics.Arcade.ArcadeBodyCollision - The collision data.

Source: src/physics/arcade/SetCollisionObject.js#L7
Since: 3.70.0


Private Members

Updated on