Welcome to Dream.In.Code
Click Here
Getting Help is Easy!

Join 118,310 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,676 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



rotation, angle and speed

 
Reply to this topicStart new topic

rotation, angle and speed

cadeownz
post 18 Jul, 2008 - 06:16 PM
Post #1


New D.I.C Head

*
Joined: 12 Jul, 2008
Posts: 31

Hey ,
i have a square, (movieClip) i have coded it so when i hit LEFT or RIGHT it rotates that way. now i need it so i can press UP and it goes up in that direction. so say its at 45 degrees when u press up it goes up that way.
heres the code..
CODE
onClipEvent(load){
    speed=7;
}
    onClipEvent(enterFrame){
        if(Key.isDown(Key.RIGHT)){
        _rotation += 5;
    }
    if(Key.isDown(Key.LEFT)){
        _rotation -= 5;
    }
}

so i need another
CODE
if(key.isDown(Key.UP)){//insert code to make it go up in thhe direction it is facing...

Thanks in advance biggrin.gif biggrin.gif
User is offlineProfile CardPM

Go to the top of the page


cadeownz
post 18 Jul, 2008 - 06:25 PM
Post #2


New D.I.C Head

*
Joined: 12 Jul, 2008
Posts: 31

Hey ,
i have a square, (movieClip) i have coded it so when i hit LEFT or RIGHT it rotates that way. now i need it so i can press UP and it goes up in that direction. so say its at 45 degrees when u press up it goes up that way.
heres the code..
CODE
onClipEvent(load){
    speed=7;
}
    onClipEvent(enterFrame){
        if(Key.isDown(Key.RIGHT)){
        _rotation += 5;
    }
    if(Key.isDown(Key.LEFT)){
        _rotation -= 5;
    }
}

so i need another
CODE
if(key.isDown(Key.UP)){
//insert code to make it go up in the direction it is facing...

Please i need this to save my RPG game..
Thanks in advance

This post has been edited by cadeownz: 18 Jul, 2008 - 10:33 PM
User is offlineProfile CardPM

Go to the top of the page

gabehabe
post 19 Jul, 2008 - 02:40 AM
Post #3


T3H R0XX0R!

Group Icon
Joined: 6 Feb, 2008
Posts: 3,518



Thanked 73 times

Dream Kudos: 2350

Expert In: (X)HTML, CSS, Batch Scripting, C, C++

My Contributions


Please don't post in multiple forums.

Posting in this one forum will suffice, there are plenty of experts here.

Threads merged.
User is online!Profile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/10/08 12:00PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month