View Single Post
  #3  
Old 04-29-2006, 10:52 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Angel_Light
Hello,

Is there any way to just advance the player foreward without reading player x y. Like just if the player is facing north east and the player just presses the up arrow and he moves foreward, north east. Then he rotates and turns south west and pushes the up and the player moves south west.

Is there anyway to do this?
For what you're talking about, you'd have to do something like:
player.x += cos(this.angle);
player.y += -sin(this.angle);

this.angle being the angle the player is facing.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote