I'm makeing a 2d game. I have enemy on scene and I have a problem with it rotation. So It has a srcipt like:
public float OffSet;
public float Length;
void Update()
{
transform.position = new Vector3(Mathf.PingPong(Time.time, Length)-OffSet, transform.position.y, transform.position.z);
}
And I want to put this code something what allow to rotate betwen 0-180 degree enemy when it turn and go to left side and turn and go to right side.
↧