I’m using this tutorial: http://www.kirupa.com/developer/actionscript/advanced_collision.htm but using bitmap images. I can’t use bitmapData because I have to target flash 7 and lower.
as you can see it’s still using the boundingbox of one image (the cursor) to test for collisions with the perimeter of the other. how can I modify the code to get this to work properly.
onClipEvent(enterFrame) {
//collision detection
hit = false; //set hit variable to false
for(i in _root.brain.perimeter) { //loop through all opjects in perimeter clip
point = new Object(); //create a new generic object to hold the coordinates
point.x = _root.brain.perimeter*._x; //x coordinate
point.y = _root.brain.perimeter*._y; //y coordinate
_root.brain.localToGlobal(point); //convert coordinates from local (within shape1) to global (_root)
if(this.hitTest(point.x, point.y, true)) { //check for collision between perimeter clip coordinates and shape 2
hit = true; //make our hit variable true
}
}
if(hit) { //check out hit variable for a true or false collision detection
this._alpha = 50; //do actions if they touching
} else {
this._alpha = 100; //do actions if they aren't touching
}
}
thank you for any input.