Moving a MC with AS question

As attached I was wondering if this is the only general coding way to move a MC to another position using action scripting.

Because due to the codes division it makes it seem like its easing out.

Problem is I need the speed to remain always constant.

Thanks,

You can have a look at robert penner’s easing equations on his site: www.robertpenner.com Lots of fun :slight_smile:

i can’t look at your fla (at school) but if you want it to be constant instead of easing just put _x += 5 instead of whatever you have to move the x value and _y += 5 instead of whatever you have for your y movement.

Now that I think of it, this is also implemented in the random motion tutorial. Basically:

nFrames = 20 ;
// I want to get there in 20 frames

curr_x = clip._x ;
curr_y = clip._y ;
next_x = random (500) ;
next_y = random (400) ;

// Each time I move, I will increment my posstion by
incr_x = (next_x - curr_x) / nFrames ;
incr_y = (next_y - curr_y) / nFrames ;
clip.i = 1 ;
clip.onEnterFrame = function () {
if (clip.i ++ < nFrames) {
this._x += incr_x ;
this._y += incr_y ;
}
else delete this.onEnterFrame ;
}