i have a little problem with my animations
any of my animations start, just the idle…
i just put a animator, and, all my animation into, so i created a code and a parameter
this is all the code that i used
using UnityEngine;
using System.Collections;
public class mov_char : MonoBehaviour {
public float speed;
private SpriteRenderer myrender;
private bool fight;
Animator anim;
// Use this for initialization
void Start () {
speed = 2.0f;
myrender = GetComponent<SpriteRenderer> ();
fight = false;
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update(){
mov ();
}
void mov(){
if (Input.GetAxisRaw ("Horizontal") < 0) {
transform.Translate (Vector2.right * speed * Time.deltaTime);
myrender.flipX = false;
anim.SetInteger ("valores_ani", 2);
} else {
anim.SetInteger ("valores_ani", 1);
}
if (Input.GetAxisRaw("Horizontal") > 0) {
transform.Translate (-Vector2.right * speed * Time.deltaTime);
myrender.flipX = true;
anim.SetInteger ("valores_ani", 2);
}else {
anim.SetInteger ("valores_ani", 1);
}
if (Input.GetMouseButtonDown (0)) {
print ("atck!");
anim.SetInteger ("valores_ani", 3);
}
if (Input.GetMouseButtonUp (0)) {
print("not attacking!");
anim.SetInteger ("valores_ani", 1);
}
}
}