# Mouse line follower

**URL:** <https://forum.kirupa.com/t/mouse-line-follower/185477>\
**Category:** Uncategorized\
**Created:** [April 13, 2006, 4:20pm UTC](https://forum.kirupa.com/t/mouse-line-follower/185477 "2006-04-13T16:20:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mofongo9](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@mofongo9](https://forum.kirupa.com/u/mofongo9)\
**Post date:** [April 13, 2006, 4:20pm UTC](https://forum.kirupa.com/t/mouse-line-follower/185477/1 "2006-04-13T16:20:32Z")

</div>

Another truly useless code from me. Makes something follow the path of the mouse. Click to increase the amount of time between the mouse movement and the ball movement.

```auto
i = 2;
BREAK = 10;
_root.createEmptyMovieClip("ball", 0);
with (ball) {
    lineStyle(10, 0xFF0000, 100);
    lineTo(.2, 0);
}
onEnterFrame = function () {
    BREAK -= 1;
    if (BREAK == 0) {
        j = 2;
    }
    _root.createEmptyMovieClip("POINT"+i, i);
    _root["POINT"+i].lineStyle(5, 0x000000, 0);
    _root["POINT"+i].lineTo(.2, 0);
    _root["POINT"+i]._x = _xmouse;
    _root["POINT"+i]._y = _ymouse;
    i++;
    ball._x = _root["POINT"+j]._x;
    ball._y = _root["POINT"+j]._y;
    j++;
};
onMouseDown = function () {
    j-=5
    savei = i;
    while (i>2) {
        unloadMovie(_root["POINT"+i]);
        i--;
    }
    if (i<=2) {
        i = savei;
    }
};

```

[URL=“[http://img364.imageshack.us/my.php?image=randommover4we.swf](http://img364.imageshack.us/my.php?image=randommover4we.swf)”]

---

<div class="post-metadata">

**Author:** ![Lujerker](https://avatars.discourse-cdn.com/v4/letter/l/bc8723/32.png) [@Lujerker](https://forum.kirupa.com/u/Lujerker)\
**Post date:** [April 13, 2006, 7:20pm UTC](https://forum.kirupa.com/t/mouse-line-follower/185477/2 "2006-04-13T19:20:29Z")

</div>

[SIZE=1]Fantastic ! 😛 [/SIZE]
