as2:rotation inside a movieclip

7 posts

Flag Post

im making a platform shooter game and i want the arm to rotate. the arm rotates just fine when its placed in the main frame but when i put the arm inside the movieclip character it rotates differently.

function convert(radians:Number):Number
{
	degrees = radians * (180 / Math.PI);
	return degrees;
}
man.onEnterFrame = function()
{
		var adjacent:Number = _xmouse - this._x;
		var opposite:Number = _ymouse - this._y;
		var angle:Number = Math.atan2(opposite, adjacent);
		man.gun._rotation = convert(angle);
}
 
Flag Post

Because xmouse and ymouse are relative to the parent.

You need _root.xmouse and _root.ymouse

And how to properly post code.

 
Flag Post

i fixed the _xmouse and _ymouse code. still doesn’t work.

 
Flag Post
Originally posted by Draco18s:

Because xmouse and ymouse are relative to the parent.

You need _root.xmouse and _root.ymouse

And how to properly post code.

I think you are wrong, he need to use man._xmouse and man._ymouse.

 
Flag Post

i think this is your 3 post for this arm of yours, do like me and ask several releveant questions in one post :)

 
Flag Post

yeah. but i solved the others this is a new one do you have any idea how to solve this?

 
Flag Post

well, can you describe what happends to the arm better or publish an fla showing it? the problem could be that you are not specific about what to rotate, do something like this root.player.arm.rotation = whatever