Detecting all kinds of shape collisions in Flash - Posted: Thu Apr 03, 2008 12:41 pm
Sanju
King
Joined: 05 Jan 2008
Posts: 16
Location: INDIA
Hi,
Im gonna teach ye how to detect all kinds of collisions in Flash.
In flash the hitTest understands everything as lines,squares,rectangles.
In this tutorial Im gonna teach you how to DETECT COLLISIONS BETWEEN CIRCLES,TRIANGLES and all other shapes you can imagine
It's very very simple than you imagine
HEREs HOW
For example Ill teach you with a circle.
1)Draw a circle and make it as a movie clip.
2)Draw another circle and make it as a movie clip and name its instance name as "c2".
3)Make 4 small circles(All 4 of the same size).Convert them into movie clips and name their instances as Left,Right,Up and Down respectively.
4)Copy the following actionscript to the tiny circle which you made.NOTE:This is only for the LEFT tiny circle.
9)Make three copies of your LEFT and RIGHT tiny circles.And arrange em like shown in the below picture(Arranged at borders of the given shape and the pattern may change according to different shapes.Exactly at the borders of the main shape.).
NOTE:SILVER colour for UP tiny circle,RED colour for RIGHT tiny circle,BLUE colour for DOWN tiny circle and GREEN colour for LEFT tiny circle.
10)Press Ctrl+Enter.
Wasn't that simple
If you got any doubts or comments reply here and Ill clarify it as soon as possible.
_________________ Enjoy the forum
Vist lrsanju.co.nr too
LIVE FREE OR DIE HARD
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum