Hello, my char only goes foward, i think there is a bug on script, so, there are my script
using UnityEngine;
using System.Collections;
public class mov_char : MonoBehaviour {
public float speed;
// Use this for initialization
void Start () {
speed = 2.0f;
}
// Update is called once per frame
void Update(){
mov ();
}
void mov(){
if (Input.GetAxisRaw("Horizontal") > 0) {
transform.Translate (Vector2.right * speed * Time.deltaTime);
transform.eulerAngles = new Vector2 (0, 0);
}
if (Input.GetAxisRaw("Horizontal") < 0) {
transform.Translate (-Vector2.right * speed * Time.deltaTime);
transform.eulerAngles = new Vector2 (0, 180);
}
}
}
Can anybody help me? whats wrong?