malkmus
October 21, 2003, 10:24am
1
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,
system
October 21, 2003, 1:11pm
2
You can have a look at robert penner’s easing equations on his site: www.robertpenner.com Lots of fun
system
October 21, 2003, 1:20pm
3
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.
system
October 21, 2003, 3:18pm
4
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 ;
}