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.