First, here's the code
using UnityEngine;
using System.Collections;
public class BMoveAI : MonoBehaviour
{
public Vector2 pos1;
public Vector2 pos2;
public float speed;
void Update()
{
transform.position = Vector3.Lerp (pos1, pos2, Mathf.PingPong (Time.time * speed, 1.0f));
}
}
So what I'm trying to do is make my Enemy's sprite flip depending on whether he is moving left or right. So my question is how I would detect moving left or right?
↧