Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hitTest question

Status
Not open for further replies.

Adam14

Technical User
Nov 8, 2003
193
CA
I have an Arrow Mc and a ball Mc, plus a button to release the Arrow. On the button I have:

on (release) {
while (_root.Arrow._x<0) {
if (_root.Arrow.hitTest(_root.ball)) {
setProperty (&quot;_root.ball&quot;, _alpha, 0);
_root.Man.gotoAndPlay(10);
} else {
setProperty (&quot;_root.Arrow&quot;, _alpha, 100);
_root.Man.gotoAndStop(3);
_level0.trigger++;
}
}
setProperty (&quot;_root.Arrow&quot;, _x, flight+(target += 200));
_root.Man.gotoAndStop(2);
}


And on the Arrow I have:

onClipEvent (load) {
this._x=100;
_root.target = 0;
}
onClipEvent (enterFrame) {
current = this._x;
flight = current+_root.target;
setProperty (this, _x, flight+target);
}


Does anyone have any idea why the Arrow is going through the ball without doing the hitTest? I had it working with just having the arrow going to _xposition 900, but when I tried to get it to &quot;move&quot; instead of jump to the _xposition 900, it doesn't seem to work. Any help would be great. It's actually for a Thanksgiving card to my sister. I had this:

which had a turkey going up and down in random _y and static _x(900), which worked fine 'cause the arrow ended up in that _x position.

I tried to have the turkey do the random_y, plus change the _x, which left the turkey outside of the ending _x position(900) of the Arrow. So I tried this:

(the ball is only in there for test purposes.

Thanks, anyone for your help. Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top