SetSpriteCategoryBits

Description

Assigns the sprite to zero or more categories for collision filtering (physics and non physics). There are 16 categories, each represented by a single bit in the "categories" parameter, a value of 1 for a bit represents that this sprite is a part of that category and 0 that it does not belong to that category. Sprites can then be set to collide with certain categories using SetSpriteCollideBits regardless of which categories they themselves belong to.

By default all sprites belong to category 1 (0x0001 the rightmost bit) and collide with all categories (0xffff).

When the sprite is not setup for physics this test will only apply to the base shape at shapeID 1.

By default this sets all shapes to the same value, you can set this value on a per shape basis by specifying a shapeID value greater than 0. Shape IDs start at 1 for the first shape, with shapeID 0 meaning apply it to all shapes.

Definition

SetSpriteCategoryBits( iSpriteIndex, categories )

SetSpriteCategoryBits( iSpriteIndex, categories, shapeID )

Parameters