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?