Hello I have basic sprite<>sprite collision working well - but I have been wondering if I could fine tune the detection a bit. (my shapes are not all perfect squares... and I have seen some "cheap deaths" in play testing) Before embarking on custom rectangles for each sprite type - I wanted to understand how the MASK argument works. Per the instruction list: 0 - &HFFFFFFFF (32 bits) * For collision detection, the AND of the bits is determined, and if it is 0, it is regarded as no collision (If omitted, &HFFFFFFFF). I'm not clear on how these 32 bits are then compared with the colliding sprite. Is this a consistent mask that is used for each (non-rotated) row of the sprite being checked? This seems plausible until I consider my 8x8 and 16x16 sprites... hmmm... Maybe I am reading too much into it? (I did try GOOGLING this little question - as well as searching through the FORUM but cannot seem to find any clues). Thanks in advance for any and all insights!The mask is like a group bitset. Per my understanding, if the mask of the two sprites are ANDed and the result is true, the collision is triggered else it's as if it never happened.
What does the MASK argument do with SPCOL
Root / Programming Questions / [.]
cujo1992Created:
Hello
I have basic sprite<>sprite collision working well - but I have been wondering if I could fine tune the detection a bit. (my shapes are not all perfect squares... and I have seen some "cheap deaths" in play testing)
Before embarking on custom rectangles for each sprite type - I wanted to understand how the MASK argument works. Per the instruction list:
0 - &HFFFFFFFF (32 bits)
* For collision detection, the AND of the bits is determined,
and if it is 0, it is regarded as no collision (If omitted, &HFFFFFFFF).
I'm not clear on how these 32 bits are then compared with the colliding sprite. Is this a consistent mask that is used for each (non-rotated) row of the sprite being checked? This seems plausible until I consider my 8x8 and 16x16 sprites... hmmm...
Maybe I am reading too much into it?
(I did try GOOGLING this little question - as well as searching through the FORUM but cannot seem to find any clues).
Thanks in advance for any and all insights!