Click to See Complete Forum and Search --> : acceleration problem

04-07-2002, 04:30 AM
I am unable to notice any visible change in the motion of my MC if I use the following code:
onClipEvent (load) {
function accel (finalX) {
distance = finalX-_x;
if (distance > 0) {
_x += ( _x * .4) ;
onClipEvent (enterFrame) {

what is wrong here?

04-07-2002, 04:44 AM
Cant see anything wrong here :)
It accelerates quite well.

Maybe your distance between finalX and _x is too small, so you dont notice, how the speed grows.

04-15-2002, 01:55 PM
I haven't tried it but theoretically speaking you should make the amount to move by depend on the distance variable, not _x.

So if you are not happy with your current code, try:

_x += distance/0.6;

(if you use 0.4, it will go further and further away - value needs to be larger than 0.5 to get closer to the target location, use larger than 1 for an easing effect, smaller than 1 for a spring effect)

not sure if this was what you were after...

- n.