Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-14-2003, 01:32 PM   #1
MadWilson
Registered User
 
Join Date: Aug 2002
Location: Omaha
Posts: 82
Default Game movement

All right this is my problem if there is a tutorial or a forum all ready posted up about this question pleas show me the direction to it.

I am attempting to make a top view video game. My question is I would like to make my Up arrow always move the person forward and Left and Right turn and Down to move back wards. How would I go about making the Up arrow always move forward in the direction that the person is facing.

I was hoping that there was a simple formula I could follow but I can’t seem to come up with one ideas welcome.

Thanks

MadWilson
MadWilson is offline   Reply With Quote
Old 05-14-2003, 01:43 PM   #2
Fugee
Grubbychops
 
Join Date: Apr 2003
Location: a very small room
Posts: 250
Default

something like this on your movie clip instance should work:
ActionScript Code:
onClipEvent (enterFrame) {     var rot = 5;     if (Key.isDown(Key.RIGHT)) {         this._rotation += rot;     }     if (Key.isDown(Key.LEFT)) {         this._rotation -= rot;     }     var speed = 10;     var x = speed * Math.cos((Math.PI/180)*_rotation);     var y = speed * Math.sin((Math.PI/180)*_rotation);     if (Key.isDown(Key.UP)) {         this._x += x;         this._y += y;     }     if (Key.isDown(Key.DOWN)) {         this._x -= x;         this._y -= y;     } }
__________________
Need to learn
Fugee is offline   Reply With Quote
Old 05-15-2003, 02:49 AM   #3
MadWilson
Registered User
 
Join Date: Aug 2002
Location: Omaha
Posts: 82
Default

thanks worked like a charm
MadWilson is offline   Reply With Quote
Old 05-16-2003, 02:35 PM   #4
Fugee
Grubbychops
 
Join Date: Apr 2003
Location: a very small room
Posts: 250
Default

no problem
__________________
Need to learn
Fugee is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:41 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.