And the function never worked if the sprite was currently in use by an active instance. But it does! If you set it to Automatic or Full bounding -- the options that make LEFT-RIGHT-TOP-BOTTOM moot, the function works just fine. I was like, "What the deuce?" It finally dawned on me: The manual says sprite_collision_mask( ) doesn't always work right because Mark never debugged it! There's a typo in the description, so Mark and anyone that may have helped him work on GM thought there was a bug in the script itself, but it was in the description.
The proper format for sprite_collision_mask( ) is:
sprite_collision_mask( sprite_index , precise , bbtype ,/*(0=Automatic, 1=Full, 2=Manual)*/ bbleft , bbtop , bbright , bbbottom , bbshape , /*Box Shape (0=Precise, 1=Rectangle, 2=Disk, 3=Diamond)*/ tolerance )
You may still need to use sprite_index=sprite_index to reset the sprite, but I didn't need to when I used sprite_collision_mask() in Debug Mode.
I don't know if this was ever fixed in Game Maker 8.1, but for anyone using the older versions, you'll need to remember Mark's order of direction was LEFT-TOP-RIGHT-BOTTOM (except in angles, which went right-top-left-bottom... ).
Update
Ok, so sprite_index=sprite_index (which simply resets the sprite) is necessary. The reason I didn't notice it at first was because the instance I tested it with was always moving. The sprite gets updated every time an instance is moved. If an instance doesn't move, its sprite stays the same. Bet ya didn't know that. Neither did I. Live and learn. So if you use sprite_collision_mask() on an instance that doesn't move every step, you need to use sprite_index=sprite_index. Also keep in mind an animated sprite will not automatically update the bounding box. The instance itself must move. (If you can prove me wrong, though, be sure to post here or let me know.)
Edited by TheouAegis, 16 January 2012 - 09:37 AM.











