Step1: Make your object.
Step2: Turn it into a movieclip.
Step3: Right click on it> Actions.
Step4: Copy and paste following code.
onClipEvent (load) {
speed = 5;
}
(This determines the allround speed)
Step5: Change the digit 5 to the speed you want.
Step6: Click on the } sign.
Step7: Copy and paste following code.
onClipEvent (enterFrame) {
if (key.isdown(key.LEFT)) {
_x-= speed;
}
if (key.isdown(key.RIGHT)) {
_x+= speed;
}
if (key.isdown(key.DOWN)) {
_y+= speed;
}
if (key.isdown(key.UP)) {
_y-= speed;
}
}
(This determines the position of itself relative to the speed varible)
Step8: Control> Test Movie
Well done! You have just made an object which can go in 8 different
directions! Now you can simply sign that to any object you wish!
| 1 |
We hope the information helped you. If you have any questions
or comments, please don't hesitate to post them on the
Forums section Submit your Tutorial at Click Here