follow the cursor... but not all the way!
im trying to create an animation that features a movie clip following the mouse cursor. the further the cursor is, the faster the movie clip moves towards it.
however, i do NOT want the MC to go all the way to the cursor.
rather, id like to have it contained within a specific area (meaning it can only travel so far towards the mouse cursor, before it is completely halted).
the current code i have (which does not stop the MC at a point, like i'd like it to) is as follows:
Code:
onClipEvent (enterFrame) {
//x movement
mx=_root._xmouse;
if (mx<_x) {
dx=_x-mx;
}
else {
dx=mx-_x;
}
moveSpeedx=dx/10;
if (mx<_x) {
_x=_x-moveSpeedx;
}
else {
_x=_x+moveSpeedx;
}
//y movement
my=_root._ymouse;
if (my<_y) {
dy=_y-my;
}
else {
dy=my-_y;
}
moveSpeedy=dy/10;
if (my<_y) {
_y=_y-moveSpeedy;
}
else {
_y=_y+moveSpeedy;
}
}
i have the action applied to the MC.
how can i alter it to get the MC to stop at a certain point?
thanks,