PDA

View Full Version : [MX] hitTest with multiple clips



Elbudster
February 2nd, 2004, 05:11 PM
Hello :nerd:

For example, say I have 3 movie clips... I want the easiest way to do a hitTest with them... The easiest way I thought of was this but it doesn't work :puzzle:


onClipEvent (load) {
mouse.hide();
walls = _root.one or _root.two or _root.three;
}
onClipEvent (enterFrame) {
this._x = _root._xmouse;
this._y = _root._ymouse;
if (this, hitTest(walls)) {
this._x = 10;
this._y = 10;
}
}


It's just a quick example of what im trying to do. one, two, and three are movieclips. Is the way I am trying possible? Or is there some easier way I could go about doing this besides writing it out for each movie clip?

flash4food
February 2nd, 2004, 07:38 PM
onClipEvent (load) {
mouse.hide();
}
onClipEvent (enterFrame) {
this._x = _root._xmouse;
this._y = _root._ymouse;
if (this.hitTest(one) || this.hitTest(two) || this.hitTest(three)) {
this._x = 10;
this._y = 10;
}
}



:thumb: :thumb: hope it helps!

Elbudster
February 2nd, 2004, 08:11 PM
Didn't work for meh :(

senocular
February 2nd, 2004, 08:17 PM
forgot _root. for the clips in the hittest calls

Elbudster
February 2nd, 2004, 08:42 PM
gracias :) didn't even notice that

eyezberg
February 3rd, 2004, 03:22 PM
more descriptive titles please!
edited.