# Rotate is offset

**URL:** https://forum.kirupa.com/t/rotate-is-offset/319736
**Category:** flash
**Created:** [March 2, 2011, 11:57pm UTC](https://forum.kirupa.com/t/rotate-is-offset/319736 "2011-03-02T23:57:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![stuffses](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@stuffses](https://forum.kirupa.com/u/stuffses)
#### Post date: [March 2, 2011, 11:57pm UTC](https://forum.kirupa.com/t/rotate-is-offset/319736/1 "2011-03-02T23:57:23Z")

</div>

Hey kirupa! I`m making a game where the player follows the mouse and shoots towards it. But I realized the laser-thing didn`t seem to be coming straight from the player. So I added a line going strait up and down on the player movie clip, and it seems that the rotate code is slightly offset. Can you help?

```auto

stage.addEventListener(Event.ENTER_FRAME,moveball);
function moveball(event:Event):void
{
	var theX:int = mouseX - map_mc.player_mc.x;
	var theY:int = (mouseY - map_mc.player_mc.y) * -1;
	var angle = Math.atan(theY/theX)/(Math.PI/180);
	if (theX < 0)
	{
		angle += 180;
	}
	if (theX >= 0 && theY < 0)
	{
		angle += 360;
	}
	map_mc.player_mc.rotation = (angle*-1) + 90;
}

```
