Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : Collision detection with random shapes?


Kevin Price-Ward
5/25/2004 10:13:40 PM
Hi all,

I'm developing a football game. I have two movie clips, a ball and a boot.
The ball is obviously a circle but the boot is a non regular shape. How do I
detect when their outlines touch or overlap to trigger an event. I've seen
plenty of collision detection examples using two balls or the mouse and a
ball, but never one with irregular outlines. Any help would be gratefully
received.

Many thanks
Kevin

aznan8
5/26/2004 9:26:16 AM
Here's a tutorial for hitTests with irregular shapes:
http://www.flashkit.com/tutorials/Games/hitTests-James_Sm-1007/index.php
Although it's meant to be for an rpg, maybe you can make it work with your
boot-ball thing.
This here is the template for an rpg created using that method to see how it
works:
http://www.flashkit.com/movies/Games/rpg_temp-James_Sm-9072/index.php
Hope it helps!
Kevin Price-Ward
5/26/2004 11:13:32 AM
That's great for checking collision of an irregular shape with a point, but
not against another irregular shape - I'm thinking here that the only way
I'm going to do this is to plot points around the second object and do a
loop through hitTesting each one against the ball on each animation frame -
I'm just worried that this is going to make the game too CPU hungry!

Kev

AddThis Social Bookmark Button