Quote:
Originally Posted by Scearezt
Yeah I got it! Thanks guys!
Final Code:
ActionScript Code:
MC._y-=Math.cos(Math.PI/180 * MC._rotation) * speed;
MC._x+=Math.sin(Math.PI/180 * MC._rotation) * speed
|
just to let you know, your _x should be cos and _y should be sine. the problem is that the direction of your sprite as you create it should be
0 degrees which, in flash (and in math and in general) is to the
RIGHT.
your code for rotation should also follow:
Code:
mc._rotation = Math.atan2(mouse._y - mc_y, mouse_x - mc_x);
stick to this and your code will make sense and you won't have to resolve things by trial and error (as it seems you've done here).