# Help! Dynamic AS curving...!

**URL:** <https://forum.kirupa.com/t/help-dynamic-as-curving/155425>\
**Category:** flash\
**Created:** [July 17, 2005, 4:46pm UTC](https://forum.kirupa.com/t/help-dynamic-as-curving/155425 "2005-07-17T16:46:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobllama](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@bobllama](https://forum.kirupa.com/u/bobllama)\
**Post date:** [July 17, 2005, 4:46pm UTC](https://forum.kirupa.com/t/help-dynamic-as-curving/155425/1 "2005-07-17T16:46:39Z")

</div>

First of all: I am very bad at math and trig.

That being stated, I need help:  
I’m trying to create a little dynamic AS MC that essentially “shoots” a missle-type thing from a fixed point to the mouse(x,y) at origination (meaning it “locks on” to the mouse(x,y) when it originates and stays locked on to that point, irrespective of where the mouse moves afterwards). I also want a trail to follow said “missle-type thingie”.

In itself this is simple, and I’ve got a working prototype (even using the drawing API). **Except** that now I want the “missle-type thingies” to **curve** towards their destination and not go in a straight line, and **randomly** at that.

So, to recap:

1. missle is originated. Locks-on to mouse(x,y)
2. rather than going straight towards it’s destination, it should arc towards it’s destination according to a random arc (think if the “missle” could follow a progressive curveTo line).
3. it needs a trail.

I’m sure this is some basic trig, but I majored in english in college. Because I was bad at math. I still am. Help me.

Here’s my code. Feel free to modify.

```auto
this.createEmptyMovieClip("curveHolder", 1);
this.createEmptyMovieClip("mover", 2);
endX = _xmouse;
endY = _ymouse;
curveHolder._x = squarey._x;
curveHolder._y = squarey._y;
curveHolder.onEnterFrame = function() {
	with (curveHolder) {
		lineStyle(0, 0x000000, 100);
		lineTo(squarey._x-curveHolder._x, squarey._y-curveHolder._y);
	}
};
mover.onEnterFrame = function() {
	squarey._x += (endX-squarey._x);
	squarey._y += (endY-squarey._y);
};

```
