0
votes

I'm messing about in actionscript 3 and am trying to move an object, I can get it to move but only on the y axis I have it set up so the object and rotate What I am trying to do is move it in the direction it is pointing so it is not just restricted to move only along the y or x axis

anyone have any tips?

1
Please post the code you have tried so far, and read the advice on how to write a good question on StackOverflow.i alarmed alien
Get its rotation, convert to radians, move as Descartes says. Should do.Vesper

1 Answers

2
votes

Just some basic trigonometry should do the trick.

var speed:Number = 10;
var angle:Number = Math.PI/2;

obj.x += speed * Math.cos(angle);
obj.y += speed * Math.sin(angle);

For more advanced wizardry I would recommend learning linear algebra. A good start can be made here :)