Search tutorials
First of all create the movieclip that will be moving around, it can be anything you want but for now just use something simple like a smiley face.
Ok now once the moveiclip is made give it an instance name. for this tutorial I called it "man". Every movieclip should be "exported for actionscript" this is done by clicking the selection with the "export for actionscript" tag when you make the movieclip. the export or linkage name should be the same as the movieclip name.
Now to get him moving enter in this code on the first frame of the scene, preferably it should be on a new layer called "actions" or something just to keep things tidy.
function onEnterFrame() {
if(Key.isDown(Key.UP))
{
man._y -=5;
}
if(Key.isDown(Key.DOWN))
{
man._y +=5;
}
if(Key.isDown(Key.LEFT))
{
man._x -=5;
}
if(Key.isDown(Key.RIGHT))
{
man._x +=5;
}
}
This will get basic movement of your character. if(Key.isDown(Key.UP))
{
man._y -=5;
}
if(Key.isDown(Key.DOWN))
{
man._y +=5;
}
if(Key.isDown(Key.LEFT))
{
man._x -=5;
}
if(Key.isDown(Key.RIGHT))
{
man._x +=5;
}
}
| » Level Intermediate |
|
Added: 2007-01-25 Rating: 7.18 Votes: 17 |
| » Author |
| Ciaran Costigan, Games Design Student |
| » Download |
| Download the files used in this tutorial. |
| Download (14 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!