Hit Test

The function hitTestObject detects if one object hits another object. One problem is that the event is considered to occur if the bounding rectangles of the two objects touch. In ActionScript the asteroid has hit the planet, even though it does not look like they are touching.

touching

Get Adobe Flash playerThere is no code in the movie, all of the code is in the Asteroid.as

Download the movie.

NEXT: Detect if an object hit a target inside another