Right I have a movieclip called Menu1 and I currently have a function that when called moves that movie clip to a set of co-ordinates. The function is run on a onEnterFrame. The codes is as follows
function moveMenu(xValue:Number, yValue:Number){
if (this.Menu1._x> xValue) {
this.Menu1._x -= 45;
}
if (this.Menu1._x< xValue) {
this.Menu1._x += 45;
}
if (this.Menu1._y> yValue) {
this.Menu1._y -= 45;
}
if (this.Menu1._y< yValue) {
this.Menu1._y += 45;
}
if (this.Menu1._x<(xValue+45) and this.Menu1._x>(xValue-45) and this.Menu1._y<(yValue+45) and this.Menu1._y>(yValue-45)) {
this.Menu1._x = xValue;
this.Menu1._y = yValue;
}
}
So at the moment, the values (x and y) are passed to the function and it moves to that location 45px per frame and when it is within 45px of the target it jumps to the exact point.
What i need help with is;
- I want the movieclip to accelerate and deaccelerate as it moves.
- At the moment it doesn’t take the direct route it only goes up down left right and at a 45 degree diagonal. I want it to go to the point in a straight line.
Can any one help me out?