I'm trying to work out where to spawn a bullet from my 40by40 pixel ship, at the moment the ship is facing north, the nose is 20 pixels away from the centre, so here is my code to try and work it out
if( rotate < 0 )
{
actRotate = 360 - (rotate * -1) ;
trace(actRotate);
}
else
{
actRotate = rotate;
}
//var rotateTemp:Number = this.rotation * (180 / Math.PI);
//this.x = xPos;
//this.y = yPos;
_speed_x = Math.sin(rotation*0.0174532925)*7.5;
_speed_y =- Math.cos(rotation*0.0174532925)*7.5;
var noseX:Number = xPos + (NoseOfShip * Math.cos(actRotate));
var noseY:Number = yPos + (NoseOfShip * Math.sin(actRotate));
this.x = noseX;
this.y = noseY;
Ok so let me just cover somethings, if i rotate my ship to the right by 90 it will give 90 as the value, if i rotate the ship by 180 degrees the value of rotate is -180, if i rotate the ship aniclockwise by 90 it is -90. Now i am really confused on why Flash CS6 does this , so I tried to create a convertor above as you can see, if rotate is minus, then just find out what it was ment to be. now this code only works if the ship is -90 (270) degrees. if the ship is 0,90,-180(180) the bullet is fighted from the nose by to its left by 20 pixels. if someone could give me a hand it would be very helpful, also if you need anymore information please post here
Thank you.