|
-
Hello! I am flashkay!
I would just like to say...I love hiTest!!!
Ok, here is one kind of HitTest that see's if a blue box that goes around the movie clip is touching another movie clip's blue box:
NOTE: the code goes inside movieclip 1
CODE:
onClipEvent (load) {
speed = 2;
}
onClipEvent (enterFrame) {
if (this.hitTest(_parent.MOIECLIP2)
this.speed = 0;
}
}
And this is to see if it is touching the actual movieclip 1, but, you can't make it slow down or anything...you can only make it stop:
NOTE: this code goes inside movieclip 1
CODE:
if (_root.MOVIECLIP1.hitTest(_x+(_width/2), _y, true)) {
this._x -= 2;
}
if (_root.MOVIECLIP1.hitTest(_x-(_width/2), _y, true)) {
this._x += 2;
}
if (_root.MOVIECLIP1.hitTest(_x, _y+(_height/2), true)) {
this._y -= 2;
}
if (_root.MOVIECLIP1.hitTest(_x, _y-(_height/2), true)) {
this._y += 2;
}
}
This might help!
Bye-bye!
~kayla
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|