Problem with collision layers

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Cobra!

Hey, I’m having a problem with using collision masks. I’m trying to make it so that the player can walk through dead enemies. The player uses layer 1 and AI uses collision layers 1 and 2, and the AI supposed to turn layer 1 off so the player can go through, and I’m doing this using:

set_collision_layer_bit(0, false)

But this doesn’t work.
What am I doing wrong?

:bust_in_silhouette: Reply From: zdimaria

The collision layer says where the object shows up for collisions. The collision mask says where to look for collisions.

So if you don’t want you player to collide with a dead enemy, make sure your player’s mask bits don’t match any of the dead enemy’s layer bits.

And vice versa: make sure the player’s layer bits don’t match any of the dead enemy’s mask bits. See this qa for more info.

markopolo | 2018-04-09 15:47