|
-
hi,
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) {
this.accel(400);
}
what is wrong here?
-
Senior Member
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.
-
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|