Create HitTestObject
Diposting oleh
Unknown
on 11/04/15
Label: Flash tutorials
In addition hitTestObject script, there is also a script hitTestPoint used to detect the point of registration points on the object.
Following the writing of the script:
1. Suppose that in the previous post Basics Using HitTestObject, there are two movie clip object is "mc_box" and "mc_oval".
2. Type the following script in frame 1.
addEventListener (Event.ENTER_FRAME, collision);
collision function (event: Event): void {
if (mc_box.hitTestPoint (mc_oval.x, mc_oval.y)) {// detect any collision
trace ("collision successfully");
}
}3. Running the program by pressing Ctrl + Enter.
Following the writing of the script:
1. Suppose that in the previous post Basics Using HitTestObject, there are two movie clip object is "mc_box" and "mc_oval".
2. Type the following script in frame 1.
addEventListener (Event.ENTER_FRAME, collision);
collision function (event: Event): void {
if (mc_box.hitTestPoint (mc_oval.x, mc_oval.y)) {// detect any collision
trace ("collision successfully");
}
}3. Running the program by pressing Ctrl + Enter.
0 komentar:
Posting Komentar