hi i need some help im still a noob at unity. i made a 2d sprite character that uses animation for movement and so on i have done everything right but im having trouble in making him stay idle until a button is pressed instead when i go to scene and hit play the character moves on his own and is not idle?? i can move him with the arrow keys in any direction i want but he will not start and stay in idle mode until you press a key or hold one down also would like him to be idle facing what ever direction you were headed when you let go of the keys. here is my script i do hope someone can help me with this.
using UnityEngine;
using System.Collections;
public class playerController : MonoBehaviour
{
private Animator animator;
// Use this for initialization
void Start()
{
animator = this.GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
var vertical = Input.GetAxis("Vertical");
var horizontal = Input.GetAxis("Horizontal");
if (vertical > 0)
{
animator.SetInteger("Direction", 2);
}
else if (vertical < 0)
{
animator.SetInteger("Direction", 0);
}
else if (horizontal > 0)
{
animator.SetInteger("Direction", 1);
}
else if (horizontal < 0)
{
animator.SetInteger("Direction", 3);
}
}
}
and if someone can help me with this i would be very happy:) i would also like some help one making a script that is like the legend of zelda a link to the past to where you can attack use items like a bow and arrow and a hud menu and all that good stuff i have all the sprites i just dont know how to script at all that good. well im gonna go and hope someone can help me with all this sorry so long. thanx and have a great day.