wow, it even runs smoother i think. you have no clue how much help that was.
I have a new problem though. The way I've been finding the newangle is i made a completely seperate MC for test purposes with this code:
onClipEvent (enterFrame) {
Xd = _root.player._x-_root.enemy._x;
Yd = _root.player._y-_root.enemy._y;
//Get _x distance from enemy to ship
//Get _y distance from enemy to ship
radAngle = Math.atan2(Yd, Xd);
//Use atan2 to calculate the angle from gun to ship
_rotation = radAngle*360/(2*Math.PI)+90;
}
This MC is placed on top of my enemy MC so it has the same x and y coordinates and constantly rotates itself to look directly at my players ship. It is the b angle in our previous formula.
This was a temporary measure for test purposes. I would either like to rest this inside the enemy MC or fix my original issue that I'll explain inside the enemy_MC code.
The code here works, only issue is it basis 0 degrees at what we would regard as 90 degrees and does the 360 degree hop at -90 degrees. So...I had to embed it in a new MC and getProperty it's rotation to fix this issue.
How would I just fix the code to avoid this very sloppy procedure?