Quote Originally Posted by adamvan101 View Post
sorry i went on vacation - i hope you're still there.
my character rotation setting things are
Code:
char.onMouseMove = function(){
var __x = _xmouse-this._x;
var __y = _ymouse-this._y;
angle=Math.atan2(__y,__x)*180/Math.PI;
this._rotation = angle + 180;
}
not gonna lie - i have no idea what this is doing :/
ok i get it all... but i dont get the "angle=" line
This code already works right? What you need is the bullet initialization code.

I think you're getting confused because I was talking about a variable named 'angle' but there's already one in your code serving a slightly different purpose.

There are two ways to measure angles: degrees and radians. Radians are used by Flash's trig functions; degrees are used by Flash's _rotation property. The conversion factor between them is 2pi/360=pi/180, which is why that ratio keeps showing up.

Let's define 'angle' in radians. Now all your stuff should work.
Code:
char.onMouseMove = function(){
	var __x = _xmouse-this._x;
	var __y = _ymouse-this._y;
	angle=Math.atan2(__y,__x); //now in radians
	this._rotation = angle*180/Math.PI + 180; //convert to degrees, turn 180
}

onMouseDown = function() {
	b = attachMovie( ... ); //make bullet
	b._x = char._x+L*Math.cos(angle);
	b._y = char._y+L*Math.sin(angle);
	b._rotation = char._rotation; //might add +180 or +/-90
}