I have question about my script,
I was managed to made the character move horizontally, but
it doens't work with animation.
whenever i press left or right,
character animation stop moving.
this is my script
also, how can i make the character idle when i am not pressing the button??
(i am not really a programmer, very new to the program, so if you guys can help me out it will be really great)
void Update() {
movement = Input.GetAxis("Horizontal") * moveSpeed;
movement *= Time.deltaTime;
transform.Translate(movement,0.0f, 0.0f); // move player along X axis
// move right
if(movement > 0.02f)
{
anim.Play("walk");
anim.animationCompleteDelegate = null;
walking = true;
}
// move left
if(movement < -0.02f)
{
anim.Play("walk");
anim.animationCompleteDelegate = null;
walking = true;
}