Phaser API Documentation

  Version: 
setCollidesWith(categories)

Description:

Sets all of the Collision Categories that this Arcade Physics Body will collide with. You can either pass a single category value, or an array of them.

Calling this method will reset all of the collision categories, so only those passed to this method are enabled.

If you wish to add a new category to the existing mask, call the addCollisionCategory method.

If you wish to reset the collision category and mask, call the resetCollisionCategory method.

Parameters:

name type description
categories number | Array.<number>

The collision category to collide with, or an array of them.

Returns:
Description:

This Game Object.

Since: 3.70.0