Hello,
I’m trying to make a dodgeball-style of game using Flash Mx 2004, and I’m having difficulty in duplicating my ball movieclips and getting my hitTest to work with each ball.
Basically, I created a cursor movieclip called cursor_mc that is dragged by moving the mouse around. This part works fine, but the trouble occurs in trying to recognize when cursor_mc hits each ball_mc. I’m using a code to duplicate the ball_mc 4 times and they move in random directions and speeds. So far, I can only get the hitTest to work on the original ball_mc from which the other 4 ball_mc’s are duplicated.
I’ve tried the following codes:
in the actions frame:
onEnterFrame = function () {
if (ball_mc.hitTest(cursor_mc)) {
trace ("ouch");
}
}
The previous code only allows the hitTest to work on the original ball_mc. Next, I tried the following two codes with no results:
on the ball_mc:
onClipEvent (enterFrame) {
if (this.hitTest(cursor_mc)) {
trace ("ouch");
}
}
and on the the cursor_mc:
onClipEvent (enterFrame) {
if (this.hitTest(ball_mc)) {
trace ("ouch");
}
}
Note: These codes weren’t used at the same time, but I was experimenting with each one individually.
Any suggestions?