PDA

View Full Version : argh! Problems with mouse trail.


pukka
04-13-2003, 07:03 PM
ok, so i have a mouse trail, it works fine, but i wanted to add some elasticity to it. How do i do it? i took the code from 2 different tutorials:
Elasticity:

onClipEvent(load){
k=.2;
damp=.9;
}
onClipEvent(enterFrame){
ax=(_root._xmouse -_x)*k;
ay=(_root._ymouse -_y)*k;
vx+=ax;
vy+=ay;
vx*=damp;
vy*=damp;
_x+=vx;
_y+=vy;
}

And mouse trail

onClipEvent (mouseMove) {
if (i >= 100) {
i = 0
}
i++;
this.duplicateMovieClip("star"+i, i+10);
_root["star"+i]._x = _root._xmouse;
_root["star"+i]._y = _root._ymouse;
}
onClipEvent (enterFrame) {
if (this._name == "starParent") {
_visible = 0;
} else {
this._alpha -= 5;
this._rotation += 2;
this._xscale -= 5;
this._yscale -= 5;
if (this._alpha<=5) {
removeMovieClip(this);
}
}
}


Is there a way i can merge these two so the original image "star" is elasticated without the trail being elasticated? HELP!

I was thinking about changing the root of the trail to the instance of a duplicate of the original "star" (below) and make the duplicate
elasticated to the mouse.

this.duplicateMovieClip("star"+i, i+10);
_root["star"+i]._x = _root._xmouse;
_root["star"+i]._y = _root._ymouse;

This would work (i think). But i would need to puton these same effects onto the duplicate MC.

onClipEvent (enterFrame) {
if (this._name == "starParent") {
_visible = 0;
} else {
this._alpha -= 5;
this._rotation += 2;
this._xscale -= 5;
this._yscale -= 5;
if (this._alpha<=5) {
removeMovieClip(this);
}
}
}

Which is no problem but i don't know how to do the bit above

Ok, now HELP!

pixelwit
04-14-2003, 03:54 AM
Used as much of your code as I could.

File attached.

Placing your code between these tags [*as]code[/*as] without the *'s will keep it formatted.

-PiXELWiT
http://www.pixelwit.com

pukka
04-14-2003, 09:26 AM
thank you! it helped alot :) I need to learn actionscript properly one day.

pixelwit
04-14-2003, 09:32 AM
You're welcome. Glad to have helped.

Now that you can format your code you're well on your way to actionScripting super-stardom. ;)

-PiXELWiT
http://www.pixelwit.com