Search tutorials
Basic Movie Clip Movement
Create a movieclip, and then enter this in its coding:onClipEvent(load){
moveSpeed=3;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x+=moveSpeed;
} else if (Key.isDown(Key.LEFT)) {
this._x-=moveSpeed;
}
if (Key.isDown(Key.DOWN)) {
this._y+=moveSpeed;
} else if (Key.isDown(Key.UP)) {
this._y-=moveSpeed;
}
}
3 as a move speed is fairly slow, feel free to change it. Also, this will not change the direction the movieclip is facing. If you want to change the way it faces for moving left and right (the movieclip should be facing right) you add this after onClipEvent(load){
xscale = _xscale;And then after this._x+=moveSpeed (and this._x-=moveSpeed):
_xscale = -xscale;
| » Level Intermediate |
|
Added: 2005-08-17 Rating: 7 Votes: 5 |
| » Author |
| Flash For Dummies |
| » Download |
| Download the files used in this tutorial. |
| Download (0 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!