I need help with my project. My sprite starts moving before the walk animation begin. Can anyone help me please
this is the script im using i know its not great, but im still new to this.
Any help would be great
using UnityEngine;
using System.Collections;
public class KnightMovement : MonoBehaviour {
public float Speed = 2;
Animator anime;
// Use this for initialization
void Start()
{
anime = GetComponent();
}
void FixedUpdate()
{
GetComponent().velocity = new Vector2(Input.GetAxis(“Horizontal”) * Speed, 0);
anime.SetFloat(“Hspeed”, Mathf.Abs(GetComponent().velocity.x));
if(GetComponent().velocity.x < 0 && transform.localScale.x > 0)
{
transform.localScale = new Vector3(-1, 1, 1);
}
if (GetComponent().velocity.x > 0 && transform.localScale.x < 0)
{
transform.localScale = new Vector3(1, 1, 1);
}
}
}