The movement in a flash game I'm developing is like the movement in Asteroids (360 degrees) but then frictionless.
I rotate the ship with the left and right keys.
And I update the ship's motion when I hit the forward key with this code.
xMotion+=Math.cos(shipDirection*Math.PI/180);
yMotion+=Math.sin(shipDirection*Math.PI/180);
Now the problem I'm having is that while the movement is frictionless I still wan't to have a hard cap on it. Ie that the ship's motion doesn't go faster then a certain value in any direction.
I'm not really that good with math and the possible solution's I've tried to get this kind of effect have failed me.
So here I am asking for advice. Oh and If I'm not mistaken I think
tan or atan is possibly needed for it as well.