Tutorials Home
What's New
Top Rated
Submit
myTutes
Random!
Making a MC follow the mouse
Author: Alexander Swagemakers
| Website: http://www.atco-websolutions.de |
The Code
The 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;
}
}
| » Level Advanced |
|
|
Added: : 2002-01-07
Rating: 9.07 Votes: 255
Hits: 171
|
| » Author |
|
Home in: Erkrath, Germany
Born in: Bayonne, France 21.05.1982
Hobbies: Gliding, Computer
Flashing since: Jan 2001
Languages: German, Dutch, English French
Founded webdesign company May 2001 but still going to school
What else do you want to know?? :-)
|
| » Download |
|
Download the files used in this tutorial.
|
|
Download (6 kb)
|
|
Get conversion and unzipping tools
for PC and Mac here!
|
| » Forums |
|
More help? Search our boards for quick answers!
|
|
Please rate this tutorial, 10 is the top rating, you can also click the
comments link to read/write a review.
|
|
|