C checkMaskCollisions

Hi -- I'm doing some simple tests with the latest (2.0.1) SDK on my mac and the PD simulator and I was curious about the checkMaskCollison function. I'm assuming that this is the equivalent to lua sdk checkAlphaCollision

but the C version has an extra arg for LCDRect there and I am struggling to understand what space that rect is relative in -- screen space? relative to bitmap1? relative to bitmap2?

When sending the circle downward at the other stationary sprite (set to kBitmapOverlap), checkMaskCollision only ever returns 1 when the circle is quite inside the other (at which point I stop the movement) and I was expecting that to happen sooner

I assume I am using the last arg of checkMaskCollisions improperly, but experimenting with values hasn't given me much insight yet

Sorry for the slow response! I got back from vacation last week and I'm still catching up..

In the source code it first creates rects from the two sets of bitmap+x+y parameters and intersects them, then intersects with the passed in rect if it's not empty. So it looks like that should be in the same coordinate system as x1,y1 and x2,y2, usually world coordinates.

Does that match what you're seeing?

thank you for the response! That will definitely help me since I was not sure what the rect was for :]

also last night I finally realized that the images I created were not done so with indexed coloring which caused some weird behaviors -- they were displaying fine but when I went to getBitmapData the resulting byte array would be full of only 0

once I went back and re-created the images using an indexed color I was able to see proper data come back from getBitmapData. I'm sure this was not helping my situation.

now that I have both pieces of the puzzle hopefully I can work the rest of this out, thanks again!

1 Like