> > http://troygilbert.com/category/game-dev/
Wow, first time I've ever seen someone else link to my blog on this list! ;-) Sweet, thanks... guess I am helping! And he's right. Here's the direct link: http://troygilbert.com/2007/06/25/pixel-perfect-collision-detection-in-actionscript3/ Also, it ranks pretty high if you just google "pixel perfect collision detection in as3". It will do exactly what you want. It factors in the complete transforms of the display objects, doesn't care what kind of display object they are, and does the checking at a pixel-perfect level and at given alpha threshold. It's pretty efficient, checking only the minimal amount of pixels, and returns a rectangle that bounds the overlapping pixels. If you read the comments there are some suggestions for potential speed improvements. While those suggestions definitely work in native apps using hardware with really fast blitters, I'm not sure if the AS3 overhead would cancel out the savings in this case as I've not done any testing. My gut is that it would, in which case the code provided is about as fast as it gets for pixel-perfect collision detection. The reason you're previous code didn't work for you (as I mentioned in the blog post) is that when doing hit tests Flash sees a bitmap as its rectangle, not as individual pixels with alpha, which is why you can't "click through" a bitmap's transparent regions to reach an object below it unless you manually forward the mouse event. Troy.