Search Tutorials
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 MovieWell done! You have just made an object which can go in 8 different directions! Now you can simply ssign that to any object you wish!
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|