Search Tutorials
The CodeThe actionscript is split up into the two kinds of movement our MC will make. First of all the movement on the x-axis (left to right and right to left) and the movement along the y-axis (up down). In the following code I'll only involve movement from left to right and vice versa.
onClipEvent (enterFrame) {
//x movement
mx=_root._xmouse;
if (mx<_x) {
dx=_x-mx;
}
else {
dx=mx-_x;
}
moveSpeedx=dx/10;
if (mx<_x) {
_x=_x-moveSpeedx;
}
else {
_x=_x+moveSpeedx;
}
}
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|