Или я полностью флэш не понимаю(недавно начал осваивать), или я тупой, но как у меня получается отрицательный синус из положительного угла?
Мне просто нужно создать шарик почти на краю пушки

Код AS3:
import flash.events.Event;
import flash.events.MouseEvent;
stop();
var angle:Number = 0;
var AB:Number = 0;
var BC:Number = 0;
var i:uint = 0;
Mouse.hide();
gun.nextFrame();
function mcursor (event:Event)
{
cursor.x = mouseX;
cursor.y = mouseY;
if ((mouseX > gun.x)&&(mouseY < gun.y))
{
AB = Math.sqrt((mouseX - gun.x)*(mouseX - gun.x)+(gun.y - mouseY)*(gun.y - mouseY))
BC = gun.y - mouseY;
angle = 90 - (Math.asin(BC/AB)* (180 / Math.PI)) + 270;
}
if ((mouseX < gun.x)&&(mouseY < gun.y))
{
AB = Math.sqrt((gun.x - mouseX)*(gun.x - mouseX)+(gun.y - mouseY)*(gun.y - mouseY))
BC = gun.y - mouseY;
angle = Math.asin(BC/AB)* (180 / Math.PI) + 180;
}
if ((mouseX < gun.x)&&(mouseY > gun.y))
{
AB = Math.sqrt((gun.x - mouseX)*(gun.x - mouseX)+(mouseY - gun.y)*(mouseY - gun.y))
BC = mouseY - gun.y;
angle = 90 - (Math.asin(BC/AB)* (180 / Math.PI)) + 90;
}
if ((mouseX > gun.x)&&(mouseY > gun.y))
{
AB = Math.sqrt((mouseX - gun.x)*(mouseX - gun.x)+(mouseY - gun.y)*(mouseY - gun.y))
BC = mouseY - gun.y;
angle = Math.asin(BC/AB)* (180 / Math.PI);
}
gun.rotation = Math.round(angle);
traceText.htmlText = ("угол: "+angle+"<br>косинус: "+Math.cos(angle)+"<br>синус: "+Math.sin(angle));
}
function addBall (event:MouseEvent)
{
var newBall:ball = new ball();
if ((mouseX > gun.x)&&(mouseY < gun.y))
{
newBall.x = gun.x + Math.cos(angle - 270) * 46.85;
newBall.y = gun.y - Math.sin(angle - 270) * 46.85;
}
if ((mouseX < gun.x)&&(mouseY < gun.y))
{
newBall.x = gun.x - Math.cos(angle - 180) * 46.85;
newBall.y = gun.y - Math.sin(angle - 180) * 46.85;
}
if ((mouseX < gun.x)&&(mouseY > gun.y))
{
newBall.x = gun.x - Math.cos(angle - 90) * 46.85;
newBall.y = gun.y + Math.sin(angle - 90) * 46.85;
}
if ((mouseX > gun.x)&&(mouseY > gun.y))
{
newBall.x = gun.x + (Math.cos(angle) * 46.85);
newBall.y = gun.y + (Math.sin(angle) * 46.85);
}
addChild(newBall).name = "ball" + i;
i ++;
}
stage.addEventListener (Event.ENTER_FRAME, mcursor);
stage.addEventListener (MouseEvent.CLICK, addBall);