# Help with enemy rotation

**URL:** https://discussions.unity.com/t/help-with-enemy-rotation/650779
**Category:** 2D
**Tags:** 2D
**Created:** [January 3, 2017, 3:42pm UTC](https://discussions.unity.com/t/help-with-enemy-rotation/650779 "2017-01-03T15:42:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nosphus](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@Nosphus](https://discussions.unity.com/u/Nosphus)
#### Post date: [January 3, 2017, 3:42pm UTC](https://discussions.unity.com/t/help-with-enemy-rotation/650779/1 "2017-01-03T15:42:02Z")

</div>

Im creating a 2d game and i have problems with enemy rotation. The enemy work and face all time the player with correct animation but when you jump over him it rotate looking up. I want make that the enemy only can face right or left. The enemy works perfectly ecept for this problem and i dont find anything.  
Im actually using this script to the rotation and work perfectly to animations.  
The only problem is that, when you jump over him it rotate to stay looking up.

transform.LookAt(target.position);  
transform.Rotate(new Vector2(0, -90), Space.Self);

Someone can help me please with something that could lock the rotation in just look left or right?

---

<div class="post-metadata">

### Author: ![Nosphus](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@Nosphus](https://discussions.unity.com/u/Nosphus)
#### Post date: [January 3, 2017, 4:00pm UTC](https://discussions.unity.com/t/help-with-enemy-rotation/650779/2 "2017-01-03T16:00:16Z")

</div>

I think if the enemy only take X position variable of the “target” it should work but i dont know how write it in the script.
