SOLVED collision_rectangle working without mask...


I put a mask_index of an object a empty sprite, so that in some conditions it doesn't collide with the object.
The place_meeting works, when the mask_index is off it will not collide (what i want).

///It works

    //Mask off
    with (argument0) {if (condition) mask_index = spr_empty;}

    //Will not check the collision
    if place_meeting(x,y,argument0) {...}
But, the collision_rectangle is not working, probably using the box of the sprite instead of the empty mask, what i could do?

///It does not work

    //Mask off
    with (argument0) {if (condition) mask_index = spr_empty;}

    //Will check the collision (i don't want that)
    if collision_rectangle(bbox_left,bbox_top,bbox_right,bbox_bottom,argument0,1,0) {...}


Forum Staff
place_meeting checks the offset mask of the calling instance against the masks of the target criteria.

collision_rectangle checks the specified rectangle against the masks of the target criteria.

See What's the Difference: Collision Functions.

Either make sure your collision checking code does not run at all if your mask is empty, or make your collision check depend on the parameters of the mask.