Flashadvisor logo
:: Desktop Shortcut
:: Flash Help
Advices from Experts

 Submit Here! · Link to Us · Newsletter · Tell a Friend ·

      Add Tutorial |

 

Advertise here










 

Google

Search WWW   
FlashAdvisor.com

 Home > Tutorials  > Beginners

Movement in 8 directions.

Author: ghost | Email
Website : mflash.times.lv


Advertisement

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 |

Rate This Tutorial :
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
  

Home | About Us | Contact Us | Feedback | Advertise with us

Best viewed in 800x600 resolution with Internet Explorer.

Site Developed and Hosted by  ethicsolutions.com
All rights reserved with FlashAdvisor

Flash is a registered trademark of Adobe Systems, Inc.

1 user online